Commit e05aea42 authored by stanisc@chromium.org's avatar stanisc@chromium.org

Make the "Tabs" item on about:sync non-yellow

This was achieved by changing ProfileSyncService::GetTypeStatusMap() to
have a special case for proxy types. A passive proxy type gets assigned
status "ok" instead of "warning" which makes it appear green on the
about:sync page.

BUG=380442

Review URL: https://codereview.chromium.org/312333005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275561 0039d316-1c4b-4281-b951-d872f2087c98
parent 72498344
...@@ -2005,6 +2005,11 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const { ...@@ -2005,6 +2005,11 @@ base::Value* ProfileSyncService::GetTypeStatusMap() const {
", " + error.message(); ", " + error.message();
type_status->SetString("status", "error"); type_status->SetString("status", "error");
type_status->SetString("value", error_text); type_status->SetString("value", error_text);
} else if (syncer::IsProxyType(type) && passive_types.Has(type)) {
// Show a proxy type in "ok" state unless it is disabled by user.
DCHECK(!throttled_types.Has(type));
type_status->SetString("status", "ok");
type_status->SetString("value", "Passive");
} else if (throttled_types.Has(type) && passive_types.Has(type)) { } else if (throttled_types.Has(type) && passive_types.Has(type)) {
type_status->SetString("status", "warning"); type_status->SetString("status", "warning");
type_status->SetString("value", "Passive, Throttled"); type_status->SetString("value", "Passive, Throttled");
......
...@@ -591,9 +591,9 @@ class ProfileSyncService : public ProfileSyncServiceBase, ...@@ -591,9 +591,9 @@ class ProfileSyncService : public ProfileSyncServiceBase,
// [ {"name": <name>, "value": <value>, "status": <status> }, ... ] // [ {"name": <name>, "value": <value>, "status": <status> }, ... ]
// where <name> is a type's name, <value> is a string providing details for // where <name> is a type's name, <value> is a string providing details for
// the type's status, and <status> is one of "error", "warning" or "ok" // the type's status, and <status> is one of "error", "warning" or "ok"
// dpending on the type's current status. // depending on the type's current status.
// //
// This function is used by sync_ui_util.cc to help populate the about:sync // This function is used by about_sync_util.cc to help populate the about:sync
// page. It returns a ListValue rather than a DictionaryValue in part to make // page. It returns a ListValue rather than a DictionaryValue in part to make
// it easier to iterate over its elements when constructing that page. // it easier to iterate over its elements when constructing that page.
base::Value* GetTypeStatusMap() const; base::Value* GetTypeStatusMap() const;
......
...@@ -311,6 +311,9 @@ SYNC_EXPORT bool NotificationTypeToRealModelType( ...@@ -311,6 +311,9 @@ SYNC_EXPORT bool NotificationTypeToRealModelType(
// Returns true if |model_type| is a real datatype // Returns true if |model_type| is a real datatype
SYNC_EXPORT bool IsRealDataType(ModelType model_type); SYNC_EXPORT bool IsRealDataType(ModelType model_type);
// Returns true if |model_type| is a proxy type
SYNC_EXPORT bool IsProxyType(ModelType model_type);
// Returns true if |model_type| is an act-once type. Act once types drop // Returns true if |model_type| is an act-once type. Act once types drop
// entities after applying them. Drops are deletes that are not synced to other // entities after applying them. Drops are deletes that are not synced to other
// clients. // clients.
......
...@@ -1057,6 +1057,10 @@ bool IsRealDataType(ModelType model_type) { ...@@ -1057,6 +1057,10 @@ bool IsRealDataType(ModelType model_type) {
return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT; return model_type >= FIRST_REAL_MODEL_TYPE && model_type < MODEL_TYPE_COUNT;
} }
bool IsProxyType(ModelType model_type) {
return model_type >= FIRST_PROXY_TYPE && model_type <= LAST_PROXY_TYPE;
}
bool IsActOnceDataType(ModelType model_type) { bool IsActOnceDataType(ModelType model_type) {
return model_type == HISTORY_DELETE_DIRECTIVES; return model_type == HISTORY_DELETE_DIRECTIVES;
} }
......
...@@ -71,6 +71,12 @@ TEST_F(ModelTypeTest, IsRealDataType) { ...@@ -71,6 +71,12 @@ TEST_F(ModelTypeTest, IsRealDataType) {
EXPECT_TRUE(IsRealDataType(APPS)); EXPECT_TRUE(IsRealDataType(APPS));
} }
TEST_F(ModelTypeTest, IsProxyType) {
EXPECT_FALSE(IsProxyType(BOOKMARKS));
EXPECT_FALSE(IsProxyType(MODEL_TYPE_COUNT));
EXPECT_TRUE(IsProxyType(PROXY_TABS));
}
// Make sure we can convert ModelTypes to and from specifics field // Make sure we can convert ModelTypes to and from specifics field
// numbers. // numbers.
TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) { TEST_F(ModelTypeTest, ModelTypeToFromSpecificsFieldNumber) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment