summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 03:58:15 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-13 03:58:15 +0000
commit2c2718e7877a01000377748dc0146ef5b1dfff4c (patch)
tree34f8ccf2932cf361fb16aba8026553b95a44f833 /sync
parent3a7e4e6b9b44ecd168a615ff6547f118602f6749 (diff)
downloadchromium_src-2c2718e7877a01000377748dc0146ef5b1dfff4c.zip
chromium_src-2c2718e7877a01000377748dc0146ef5b1dfff4c.tar.gz
chromium_src-2c2718e7877a01000377748dc0146ef5b1dfff4c.tar.bz2
[Sync] Add support for syncing tab favicons.
This functionality is currently behind a flag. We only support writing a new favicon when the tab's current url changes. This avoids possible issues due to website-controlled favicons. On the receiving end, we use the historydb's AddPageNoVisitForBookmark functionality to locally load the favicon without needing history visits. BUG=92728 TEST=manual inspection with --sync-tab-favicons Review URL: http://codereview.chromium.org/9924028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/protocol/proto_enum_conversions.cc11
-rw-r--r--sync/protocol/proto_enum_conversions.h3
-rw-r--r--sync/protocol/proto_value_conversions.cc3
-rw-r--r--sync/protocol/session_specifics.proto14
4 files changed, 31 insertions, 0 deletions
diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc
index d3a5dec..24bb9a1 100644
--- a/sync/protocol/proto_enum_conversions.cc
+++ b/sync/protocol/proto_enum_conversions.cc
@@ -157,6 +157,17 @@ const char* GetDeviceTypeString(
return "";
}
+const char* GetFaviconTypeString(
+ sync_pb::SessionTab::FaviconType favicon_type) {
+ ASSERT_ENUM_BOUNDS(sync_pb::SessionTab, FaviconType, TYPE_WEB_FAVICON,
+ TYPE_WEB_FAVICON);
+ switch (favicon_type) {
+ ENUM_CASE(sync_pb::SessionTab, TYPE_WEB_FAVICON);
+ }
+ NOTREACHED();
+ return "";
+}
+
#undef ASSERT_ENUM_BOUNDS
#undef ENUM_CASE
diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h
index 450e13f..30989a1 100644
--- a/sync/protocol/proto_enum_conversions.h
+++ b/sync/protocol/proto_enum_conversions.h
@@ -42,6 +42,9 @@ const char* GetActionString(sync_pb::SyncEnums::Action action);
const char* GetDeviceTypeString(
sync_pb::SessionHeader::DeviceType device_type);
+const char* GetFaviconTypeString(
+ sync_pb::SessionTab::FaviconType favicon_type);
+
} // namespace browser_sync
#endif // SYNC_PROTOCOL_PROTO_ENUM_CONVERSIONS_H_
diff --git a/sync/protocol/proto_value_conversions.cc b/sync/protocol/proto_value_conversions.cc
index 828c9f5..472626c 100644
--- a/sync/protocol/proto_value_conversions.cc
+++ b/sync/protocol/proto_value_conversions.cc
@@ -138,6 +138,9 @@ DictionaryValue* SessionTabToValue(
SET_BOOL(pinned);
SET_STR(extension_app_id);
SET_REP(navigation, TabNavigationToValue);
+ SET_BYTES(favicon);
+ SET_ENUM(favicon_type, GetFaviconTypeString);
+ SET_STR(favicon_source);
return value;
}
diff --git a/sync/protocol/session_specifics.proto b/sync/protocol/session_specifics.proto
index cf31aed..e2b441d 100644
--- a/sync/protocol/session_specifics.proto
+++ b/sync/protocol/session_specifics.proto
@@ -23,6 +23,7 @@ message SessionSpecifics {
// The local tab id used by sync. Unique across all nodes for that client.
optional int32 tab_node_id = 4 [default = -1];
}
+
// Properties of session sync objects.
message SessionHeader {
// Each session is composed of windows.
@@ -41,6 +42,7 @@ message SessionHeader {
}
optional DeviceType device_type = 4;
}
+
message SessionWindow {
// Unique (to the owner) id for this window.
optional int32 window_id = 1;
@@ -56,6 +58,7 @@ message SessionWindow {
// The tabs that compose a window (correspond to tab id's).
repeated int32 tab = 4;
}
+
message SessionTab {
// Unique (to the owner) id for this tab.
optional int32 tab_id = 1;
@@ -73,7 +76,18 @@ message SessionTab {
optional string extension_app_id = 6;
// Tabs are navigated, and the navigation data is here.
repeated TabNavigation navigation = 7;
+ // The favicon for the current url the tab is displaying. Either empty
+ // or a valid PNG encoded favicon.
+ optional bytes favicon = 8;
+ // The type of favicon. For now only normal web favicons are supported.
+ enum FaviconType {
+ TYPE_WEB_FAVICON = 1;
+ }
+ optional FaviconType favicon_type = 9;
+ // The url of the actual favicon (as opposed to the page using the favicon).
+ optional string favicon_source = 11;
}
+
message TabNavigation {
// The index in the NavigationController. If this is -1, it means this
// TabNavigation is bogus.