summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-16 00:01:01 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-16 00:01:01 +0000
commit4514f801f6d46cfb524910ac2379ee2125e9cbe8 (patch)
treeaf84478616098854f651e16221dbeb1606b53ddd /sync
parente76609c0945e56be270ba7364b45651af2c1c9f0 (diff)
downloadchromium_src-4514f801f6d46cfb524910ac2379ee2125e9cbe8.zip
chromium_src-4514f801f6d46cfb524910ac2379ee2125e9cbe8.tar.gz
chromium_src-4514f801f6d46cfb524910ac2379ee2125e9cbe8.tar.bz2
[Sync] Move PageTransitions enums to SyncEnums
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10382183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137309 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/protocol/proto_enum_conversions.cc38
-rw-r--r--sync/protocol/proto_enum_conversions.h4
-rw-r--r--sync/protocol/proto_enum_conversions_unittest.cc12
-rw-r--r--sync/protocol/session_specifics.proto27
-rw-r--r--sync/protocol/sync_enums.proto23
5 files changed, 54 insertions, 50 deletions
diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc
index 24bb9a1..864f052 100644
--- a/sync/protocol/proto_enum_conversions.cc
+++ b/sync/protocol/proto_enum_conversions.cc
@@ -33,36 +33,36 @@ const char* GetBrowserTypeString(
}
const char* GetPageTransitionString(
- sync_pb::TabNavigation::PageTransition page_transition) {
- ASSERT_ENUM_BOUNDS(sync_pb::TabNavigation, PageTransition,
+ sync_pb::SyncEnums::PageTransition page_transition) {
+ ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, PageTransition,
LINK, CHAIN_END);
switch (page_transition) {
- ENUM_CASE(sync_pb::TabNavigation, LINK);
- ENUM_CASE(sync_pb::TabNavigation, TYPED);
- ENUM_CASE(sync_pb::TabNavigation, AUTO_BOOKMARK);
- ENUM_CASE(sync_pb::TabNavigation, AUTO_SUBFRAME);
- ENUM_CASE(sync_pb::TabNavigation, MANUAL_SUBFRAME);
- ENUM_CASE(sync_pb::TabNavigation, GENERATED);
- ENUM_CASE(sync_pb::TabNavigation, START_PAGE);
- ENUM_CASE(sync_pb::TabNavigation, FORM_SUBMIT);
- ENUM_CASE(sync_pb::TabNavigation, RELOAD);
- ENUM_CASE(sync_pb::TabNavigation, KEYWORD);
- ENUM_CASE(sync_pb::TabNavigation, KEYWORD_GENERATED);
- ENUM_CASE(sync_pb::TabNavigation, CHAIN_START);
- ENUM_CASE(sync_pb::TabNavigation, CHAIN_END);
+ ENUM_CASE(sync_pb::SyncEnums, LINK);
+ ENUM_CASE(sync_pb::SyncEnums, TYPED);
+ ENUM_CASE(sync_pb::SyncEnums, AUTO_BOOKMARK);
+ ENUM_CASE(sync_pb::SyncEnums, AUTO_SUBFRAME);
+ ENUM_CASE(sync_pb::SyncEnums, MANUAL_SUBFRAME);
+ ENUM_CASE(sync_pb::SyncEnums, GENERATED);
+ ENUM_CASE(sync_pb::SyncEnums, START_PAGE);
+ ENUM_CASE(sync_pb::SyncEnums, FORM_SUBMIT);
+ ENUM_CASE(sync_pb::SyncEnums, RELOAD);
+ ENUM_CASE(sync_pb::SyncEnums, KEYWORD);
+ ENUM_CASE(sync_pb::SyncEnums, KEYWORD_GENERATED);
+ ENUM_CASE(sync_pb::SyncEnums, CHAIN_START);
+ ENUM_CASE(sync_pb::SyncEnums, CHAIN_END);
}
NOTREACHED();
return "";
}
const char* GetPageTransitionQualifierString(
- sync_pb::TabNavigation::PageTransitionQualifier
+ sync_pb::SyncEnums::PageTransitionQualifier
page_transition_qualifier) {
- ASSERT_ENUM_BOUNDS(sync_pb::TabNavigation, PageTransitionQualifier,
+ ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, PageTransitionQualifier,
CLIENT_REDIRECT, SERVER_REDIRECT);
switch (page_transition_qualifier) {
- ENUM_CASE(sync_pb::TabNavigation, CLIENT_REDIRECT);
- ENUM_CASE(sync_pb::TabNavigation, SERVER_REDIRECT);
+ ENUM_CASE(sync_pb::SyncEnums, CLIENT_REDIRECT);
+ ENUM_CASE(sync_pb::SyncEnums, SERVER_REDIRECT);
}
NOTREACHED();
return "";
diff --git a/sync/protocol/proto_enum_conversions.h b/sync/protocol/proto_enum_conversions.h
index 30989a1..abb65ed1 100644
--- a/sync/protocol/proto_enum_conversions.h
+++ b/sync/protocol/proto_enum_conversions.h
@@ -23,10 +23,10 @@ const char* GetBrowserTypeString(
sync_pb::SessionWindow::BrowserType browser_type);
const char* GetPageTransitionString(
- sync_pb::TabNavigation::PageTransition page_transition);
+ sync_pb::SyncEnums::PageTransition page_transition);
const char* GetPageTransitionQualifierString(
- sync_pb::TabNavigation::PageTransitionQualifier
+ sync_pb::SyncEnums::PageTransitionQualifier
page_transition_qualifier);
const char* GetUpdatesSourceString(
diff --git a/sync/protocol/proto_enum_conversions_unittest.cc b/sync/protocol/proto_enum_conversions_unittest.cc
index 6cfa26c..d007348 100644
--- a/sync/protocol/proto_enum_conversions_unittest.cc
+++ b/sync/protocol/proto_enum_conversions_unittest.cc
@@ -36,19 +36,19 @@ TEST_F(ProtoEnumConversionsTest, GetPageTransitionString) {
// We have a gap, so we need to do two ranges.
TestEnumStringFunction(
GetPageTransitionString,
- sync_pb::TabNavigation::PageTransition_MIN,
- sync_pb::TabNavigation::KEYWORD_GENERATED);
+ sync_pb::SyncEnums::PageTransition_MIN,
+ sync_pb::SyncEnums::KEYWORD_GENERATED);
TestEnumStringFunction(
GetPageTransitionString,
- sync_pb::TabNavigation::CHAIN_START,
- sync_pb::TabNavigation::PageTransition_MAX);
+ sync_pb::SyncEnums::CHAIN_START,
+ sync_pb::SyncEnums::PageTransition_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetPageTransitionQualifierString) {
TestEnumStringFunction(
GetPageTransitionQualifierString,
- sync_pb::TabNavigation::PageTransitionQualifier_MIN,
- sync_pb::TabNavigation::PageTransitionQualifier_MAX);
+ sync_pb::SyncEnums::PageTransitionQualifier_MIN,
+ sync_pb::SyncEnums::PageTransitionQualifier_MAX);
}
TEST_F(ProtoEnumConversionsTest, GetUpdatesSourceString) {
diff --git a/sync/protocol/session_specifics.proto b/sync/protocol/session_specifics.proto
index 4389243..c00b8a0 100644
--- a/sync/protocol/session_specifics.proto
+++ b/sync/protocol/session_specifics.proto
@@ -14,6 +14,8 @@ option retain_unknown_fields = true;
package sync_pb;
+import "sync_enums.proto";
+
message SessionSpecifics {
// Unique id for the client.
optional string session_tag = 1;
@@ -103,29 +105,8 @@ message TabNavigation {
// state of the page. This includes form entries and scroll position for each
// frame.
optional string state = 5;
- // Types of transitions between pages.
- enum PageTransition {
- LINK = 0;
- TYPED = 1;
- AUTO_BOOKMARK = 2;
- AUTO_SUBFRAME = 3;
- MANUAL_SUBFRAME = 4;
- GENERATED = 5;
- START_PAGE = 6;
- FORM_SUBMIT = 7;
- RELOAD = 8;
- KEYWORD = 9;
- KEYWORD_GENERATED = 10;
- CHAIN_START = 12;
- CHAIN_END = 13;
- }
- // These qualifiers further define the transition.
- enum PageTransitionQualifier {
- CLIENT_REDIRECT = 1;
- SERVER_REDIRECT = 2;
- }
- optional PageTransition page_transition = 6 [default = TYPED];
- optional PageTransitionQualifier navigation_qualifier = 7;
+ optional SyncEnums.PageTransition page_transition = 6 [default = TYPED];
+ optional SyncEnums.PageTransitionQualifier navigation_qualifier = 7;
// The unique navigation id (within this client).
optional int32 unique_id = 8;
// Timestamp for when this navigation last occurred (in client time).
diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto
index e419183..0842cff 100644
--- a/sync/protocol/sync_enums.proto
+++ b/sync/protocol/sync_enums.proto
@@ -35,6 +35,29 @@ message SyncEnums {
ACTIONABLE_ERROR = 8; // Client received an actionable error.
}
+ // Types of transitions between pages.
+ enum PageTransition {
+ LINK = 0;
+ TYPED = 1;
+ AUTO_BOOKMARK = 2;
+ AUTO_SUBFRAME = 3;
+ MANUAL_SUBFRAME = 4;
+ GENERATED = 5;
+ START_PAGE = 6;
+ FORM_SUBMIT = 7;
+ RELOAD = 8;
+ KEYWORD = 9;
+ KEYWORD_GENERATED = 10;
+ CHAIN_START = 12;
+ CHAIN_END = 13;
+ }
+
+ // These qualifiers further define the transition.
+ enum PageTransitionQualifier {
+ CLIENT_REDIRECT = 1;
+ SERVER_REDIRECT = 2;
+ }
+
enum ErrorType {
SUCCESS = 0;
ACCESS_DENIED = 1; // Returned when the user doesn't have access to