summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 03:54:40 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-25 03:54:40 +0000
commit40f04797e143e6b3fe59dbccdf7053aa2a7a2fe6 (patch)
tree0037cf6381a4876ee66f1f6330b0d1aef551815e
parent6a7e698052d3b0d0aafebd5ac6af0ef2f95ff2a9 (diff)
downloadchromium_src-40f04797e143e6b3fe59dbccdf7053aa2a7a2fe6.zip
chromium_src-40f04797e143e6b3fe59dbccdf7053aa2a7a2fe6.tar.gz
chromium_src-40f04797e143e6b3fe59dbccdf7053aa2a7a2fe6.tar.bz2
Changed SyncStatusUIHelper namespace class into a real namespace (sync_ui_util), per style guide.
Changed static functions into anonymous-namespace functions. Renamed files/namespaces from sync_status_ui_helper to sync_ui_util. Moved sync_ui_util_mac.mm functions into sync_ui_util namespace. Updated all callers. BUG=none TEST=trybots Review URL: http://codereview.chromium.org/414065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33044 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/app_controller_mac.mm8
-rw-r--r--chrome/browser/browser.cc4
-rw-r--r--chrome/browser/cocoa/browser_window_controller.h2
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm4
-rw-r--r--chrome/browser/cocoa/browser_window_controller_unittest.mm2
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm4
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.cc12
-rw-r--r--chrome/browser/dom_ui/new_tab_page_sync_handler.h4
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc8
-rw-r--r--chrome/browser/gtk/browser_toolbar_gtk.cc8
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc6
-rw-r--r--chrome/browser/sync/sync_status_ui_helper.h38
-rw-r--r--chrome/browser/sync/sync_ui_util.cc (renamed from chrome/browser/sync/sync_status_ui_helper.cc)29
-rw-r--r--chrome/browser/sync/sync_ui_util.h36
-rw-r--r--chrome/browser/sync/sync_ui_util_mac.h (renamed from chrome/browser/sync/sync_status_ui_helper_mac.h)14
-rw-r--r--chrome/browser/sync/sync_ui_util_mac.mm (renamed from chrome/browser/sync/sync_status_ui_helper_mac.mm)20
-rw-r--r--chrome/browser/sync/sync_ui_util_mac_unittest.mm (renamed from chrome/browser/sync/sync_status_ui_helper_mac_unittest.mm)28
-rw-r--r--chrome/browser/views/bookmark_bar_view.cc8
-rw-r--r--chrome/browser/views/bookmark_manager_view.cc8
-rw-r--r--chrome/browser/views/options/content_page_view.cc6
-rw-r--r--chrome/browser/views/toolbar_view.cc8
-rwxr-xr-xchrome/chrome.gyp10
22 files changed, 135 insertions, 132 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index ba41a4d..b80780a 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -34,8 +34,8 @@
#include "chrome/browser/options_window.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
-#include "chrome/browser/sync/sync_status_ui_helper_mac.h"
+#include "chrome/browser/sync/sync_ui_util.h"
+#include "chrome/browser/sync/sync_ui_util_mac.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
@@ -489,7 +489,7 @@ static bool g_is_opening_new_window = false;
break;
case IDC_SYNC_BOOKMARKS:
enable = ProfileSyncService::IsSyncEnabled();
- browser_sync::UpdateSyncItem(item, enable, [self defaultProfile]);
+ sync_ui_util::UpdateSyncItem(item, enable, [self defaultProfile]);
break;
default:
enable = menuState_->IsCommandEnabled(tag) ? YES : NO;
@@ -576,7 +576,7 @@ static bool g_is_opening_new_window = false;
case IDC_SYNC_BOOKMARKS:
// TODO(akalin): Add a constant to denote starting sync from the
// main menu and use that instead of START_FROM_WRENCH.
- SyncStatusUIHelper::OpenSyncMyBookmarksDialog(
+ sync_ui_util::OpenSyncMyBookmarksDialog(
defaultProfile, ProfileSyncService::START_FROM_WRENCH);
break;
};
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 602f5f5..821b901 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -46,7 +46,7 @@
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/status_bubble.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -1284,7 +1284,7 @@ void Browser::OpenImportSettingsDialog() {
}
void Browser::OpenSyncMyBookmarksDialog() {
- SyncStatusUIHelper::OpenSyncMyBookmarksDialog(
+ sync_ui_util::OpenSyncMyBookmarksDialog(
profile_, ProfileSyncService::START_FROM_WRENCH);
}
diff --git a/chrome/browser/cocoa/browser_window_controller.h b/chrome/browser/cocoa/browser_window_controller.h
index 38f76fc..02e04d9 100644
--- a/chrome/browser/cocoa/browser_window_controller.h
+++ b/chrome/browser/cocoa/browser_window_controller.h
@@ -19,7 +19,7 @@
#import "chrome/browser/cocoa/bookmark_bubble_controller.h"
#import "chrome/browser/cocoa/browser_command_executor.h"
#import "chrome/browser/cocoa/view_resizer.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#import "third_party/GTM/AppKit/GTMTheme.h"
class Browser;
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 6db46e1..b5c2dd1 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -42,7 +42,7 @@
#import "chrome/browser/cocoa/toolbar_controller.h"
#import "chrome/browser/browser_theme_provider.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper_mac.h"
+#include "chrome/browser/sync/sync_ui_util_mac.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#import "chrome/browser/cocoa/background_gradient_view.h"
@@ -673,7 +673,7 @@ willPositionSheet:(NSWindow*)sheet
break;
case IDC_SYNC_BOOKMARKS:
enable &= ProfileSyncService::IsSyncEnabled();
- browser_sync::UpdateSyncItem(item, enable, browser_->profile());
+ sync_ui_util::UpdateSyncItem(item, enable, browser_->profile());
break;
default:
// Special handling for the contents of the Text Encoding submenu. On
diff --git a/chrome/browser/cocoa/browser_window_controller_unittest.mm b/chrome/browser/cocoa/browser_window_controller_unittest.mm
index 857cbd9..1457a1a 100644
--- a/chrome/browser/cocoa/browser_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/browser_window_controller_unittest.mm
@@ -13,7 +13,7 @@
#include "chrome/browser/cocoa/browser_window_controller.h"
#include "chrome/browser/cocoa/cocoa_test_helper.h"
#include "chrome/browser/cocoa/find_bar_bridge.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/test/testing_browser_process.h"
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 2137d2d..bcfb2f1 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -30,7 +30,7 @@
#include "chrome/browser/session_startup_pref.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_observer.h"
@@ -1592,7 +1592,7 @@ const int kDisabledIndex = 1;
[syncButton_ setTitle:buttonLabel];
string16 statusLabel, linkLabel;
- SyncStatusUIHelper::GetLabels(syncService_, &statusLabel, &linkLabel);
+ sync_ui_util::GetStatusLabels(syncService_, &statusLabel, &linkLabel);
[syncStatus_ setStringValue:base::SysUTF16ToNSString(statusLabel)];
}
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index 466931a..1e494ae 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -82,12 +82,12 @@ NewTabPageSyncHandler::~NewTabPageSyncHandler() {
// static
NewTabPageSyncHandler::MessageType
NewTabPageSyncHandler::FromSyncStatusMessageType(
- SyncStatusUIHelper::MessageType type) {
+ sync_ui_util::MessageType type) {
switch (type) {
- case SyncStatusUIHelper::SYNC_ERROR:
+ case sync_ui_util::SYNC_ERROR:
return SYNC_ERROR;
- case SyncStatusUIHelper::PRE_SYNCED:
- case SyncStatusUIHelper::SYNCED:
+ case sync_ui_util::PRE_SYNCED:
+ case sync_ui_util::SYNCED:
default:
return HIDE;
}
@@ -138,8 +138,8 @@ void NewTabPageSyncHandler::BuildAndSendSyncStatus() {
// message).
string16 status_msg;
string16 link_text;
- SyncStatusUIHelper::MessageType type =
- SyncStatusUIHelper::GetLabels(sync_service_, &status_msg, &link_text);
+ sync_ui_util::MessageType type =
+ sync_ui_util::GetStatusLabels(sync_service_, &status_msg, &link_text);
SendSyncMessageToPage(FromSyncStatusMessageType(type),
UTF16ToUTF8(status_msg), UTF16ToUTF8(link_text));
}
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.h b/chrome/browser/dom_ui/new_tab_page_sync_handler.h
index 67b565c..fcd2a7a 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.h
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.h
@@ -9,7 +9,7 @@
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
class Value;
@@ -52,7 +52,7 @@ class NewTabPageSyncHandler : public DOMMessageHandler,
// Helper to convert from a sync status message type to an NTP specific one.
static MessageType FromSyncStatusMessageType(
- SyncStatusUIHelper::MessageType type);
+ sync_ui_util::MessageType type);
// Cached pointer to ProfileSyncService.
ProfileSyncService* sync_service_;
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index 67c1d16..c48042f 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -33,7 +33,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/gtk_util.h"
@@ -1321,10 +1321,10 @@ bool BookmarkBarGtk::ShouldShowSyncErrorButton() {
if (sync_service_ && sync_service_->HasSyncSetupCompleted()) {
string16 status_text;
string16 link_text;
- SyncStatusUIHelper::MessageType sync_status;
- sync_status = SyncStatusUIHelper::GetLabels(
+ sync_ui_util::MessageType sync_status;
+ sync_status = sync_ui_util::GetStatusLabels(
sync_service_, &status_text, &link_text);
- if (sync_status == SyncStatusUIHelper::SYNC_ERROR) {
+ if (sync_status == sync_ui_util::SYNC_ERROR) {
show_sync_error_button = true;
}
}
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 9fc35fb..f59853d 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -34,7 +34,7 @@
#include "chrome/browser/gtk/view_id_util.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_details.h"
@@ -703,12 +703,12 @@ void BrowserToolbarGtk::OnStateChanged() {
string16 link;
// TODO(zork): Need a ui helper method to just get the type without
// needing labels.
- SyncStatusUIHelper::MessageType type = SyncStatusUIHelper::GetLabels(
+ sync_ui_util::MessageType type = sync_ui_util::GetStatusLabels(
sync_service_, &label, &link);
- int menu_label = type == SyncStatusUIHelper::SYNCED ?
+ int menu_label = type == sync_ui_util::SYNCED ?
IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL :
- type == SyncStatusUIHelper::SYNC_ERROR ?
+ type == sync_ui_util::SYNC_ERROR ?
IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL :
IDS_SYNC_START_SYNC_BUTTON_LABEL;
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index 0dfd8e1..b4d67ba 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/gtk/import_dialog_gtk.h"
#include "chrome/browser/gtk/options/options_layout_gtk.h"
#include "chrome/browser/gtk/options/passwords_exceptions_window_gtk.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
@@ -353,8 +353,8 @@ void ContentPageGtk::UpdateSyncControls() {
string16 link_label;
std::string button_label;
bool sync_setup_completed = sync_service_->HasSyncSetupCompleted();
- bool status_has_error = SyncStatusUIHelper::GetLabels(sync_service_,
- &status_label, &link_label) == SyncStatusUIHelper::SYNC_ERROR;
+ bool status_has_error = sync_ui_util::GetStatusLabels(sync_service_,
+ &status_label, &link_label) == sync_ui_util::SYNC_ERROR;
if (sync_setup_completed) {
button_label = l10n_util::GetStringUTF8(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
} else if (sync_service_->SetupInProgress()) {
diff --git a/chrome/browser/sync/sync_status_ui_helper.h b/chrome/browser/sync/sync_status_ui_helper.h
deleted file mode 100644
index fac77ea..0000000
--- a/chrome/browser/sync/sync_status_ui_helper.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_H_
-#define CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_H_
-
-#include "base/string16.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-
-class Profile;
-
-// Utility to gather current sync status information from the sync service and
-// constructs messages suitable for showing in UI.
-class SyncStatusUIHelper {
- public:
- enum MessageType {
- PRE_SYNCED, // User has not set up sync.
- SYNCED, // We are synced and authenticated to a gmail account.
- SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
- };
-
- // Create status and link labels for the current status labels and link text
- // by querying |service|.
- static MessageType GetLabels(ProfileSyncService* service,
- string16* status_label,
- string16* link_label);
-
- // Open the appropriate sync dialog for the given profile (which can be
- // incognito). |code| should be one of the START_FROM_* codes.
- static void OpenSyncMyBookmarksDialog(
- Profile* profile, ProfileSyncService::SyncEventCodes code);
-
- private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(SyncStatusUIHelper);
-};
-
-#endif // CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_H_
diff --git a/chrome/browser/sync/sync_status_ui_helper.cc b/chrome/browser/sync/sync_ui_util.cc
index c6a2aa7..b973362 100644
--- a/chrome/browser/sync/sync_status_ui_helper.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "app/l10n_util.h"
#include "base/string_util.h"
@@ -14,10 +14,14 @@
typedef GoogleServiceAuthError AuthError;
+namespace sync_ui_util {
+
+namespace {
+
// Given an authentication state, this helper function returns the appropriate
// status message and, if necessary, the text that should appear in the
// re-login link.
-static void GetLabelsForAuthError(const AuthError& auth_error,
+void GetStatusLabelsForAuthError(const AuthError& auth_error,
ProfileSyncService* service, string16* status_label,
string16* link_label) {
if (link_label)
@@ -48,7 +52,7 @@ static void GetLabelsForAuthError(const AuthError& auth_error,
// Returns the message that should be displayed when the user is authenticated
// and can connect to the sync server. If the user hasn't yet authenticated, an
// empty string is returned.
-static string16 GetSyncedStateStatusLabel(ProfileSyncService* service) {
+string16 GetSyncedStateStatusLabel(ProfileSyncService* service) {
string16 label;
string16 user_name(service->GetAuthenticatedUsername());
if (user_name.empty())
@@ -60,10 +64,11 @@ static string16 GetSyncedStateStatusLabel(ProfileSyncService* service) {
WideToUTF16(service->GetLastSyncedTimeString()));
}
-// static
-SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels(
- ProfileSyncService* service, string16* status_label,
- string16* link_label) {
+} // namespace
+
+MessageType GetStatusLabels(ProfileSyncService* service,
+ string16* status_label,
+ string16* link_label) {
MessageType result_type(SYNCED);
if (!service) {
@@ -85,7 +90,8 @@ SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels(
l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL));
result_type = PRE_SYNCED;
} else if (auth_error.state() != AuthError::NONE) {
- GetLabelsForAuthError(auth_error, service, status_label, link_label);
+ GetStatusLabelsForAuthError(auth_error, service,
+ status_label, link_label);
result_type = SYNC_ERROR;
}
} else {
@@ -102,7 +108,7 @@ SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels(
l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL));
} else if (auth_error.state() != AuthError::NONE) {
status_label->clear();
- GetLabelsForAuthError(auth_error, service, status_label, NULL);
+ GetStatusLabelsForAuthError(auth_error, service, status_label, NULL);
result_type = SYNC_ERROR;
} else if (!status.authenticated) {
status_label->assign(
@@ -118,8 +124,7 @@ SyncStatusUIHelper::MessageType SyncStatusUIHelper::GetLabels(
return result_type;
}
-// static
-void SyncStatusUIHelper::OpenSyncMyBookmarksDialog(
+void OpenSyncMyBookmarksDialog(
Profile* profile, ProfileSyncService::SyncEventCodes code) {
ProfileSyncService* service =
profile->GetOriginalProfile()->GetProfileSyncService();
@@ -135,3 +140,5 @@ void SyncStatusUIHelper::OpenSyncMyBookmarksDialog(
}
}
+} // namespace sync_ui_util
+
diff --git a/chrome/browser/sync/sync_ui_util.h b/chrome/browser/sync/sync_ui_util.h
new file mode 100644
index 0000000..a80359b
--- /dev/null
+++ b/chrome/browser/sync/sync_ui_util.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
+#define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
+
+#include "base/string16.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+
+class Profile;
+
+// Utility functions to gather current sync status information from the sync
+// service and constructs messages suitable for showing in UI.
+namespace sync_ui_util {
+
+enum MessageType {
+ PRE_SYNCED, // User has not set up sync.
+ SYNCED, // We are synced and authenticated to a gmail account.
+ SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
+};
+
+// Create status and link labels for the current status labels and link text
+// by querying |service|.
+MessageType GetStatusLabels(ProfileSyncService* service,
+ string16* status_label,
+ string16* link_label);
+
+// Open the appropriate sync dialog for the given profile (which can be
+// incognito). |code| should be one of the START_FROM_* codes.
+void OpenSyncMyBookmarksDialog(
+ Profile* profile, ProfileSyncService::SyncEventCodes code);
+} // namespace sync_ui_util
+
+#endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
+
diff --git a/chrome/browser/sync/sync_status_ui_helper_mac.h b/chrome/browser/sync/sync_ui_util_mac.h
index 36b9bb3..65fba88 100644
--- a/chrome/browser/sync/sync_status_ui_helper_mac.h
+++ b/chrome/browser/sync/sync_ui_util_mac.h
@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_MAC_H_
-#define CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_MAC_H_
+#ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
+#define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#import <Cocoa/Cocoa.h>
class Profile;
-namespace browser_sync {
+namespace sync_ui_util {
// Updates a bookmark sync UI item (expected to be a menu item). This is
// called every time a menu containing a sync UI item is displayed.
@@ -20,9 +20,9 @@ void UpdateSyncItem(id syncItem, BOOL syncEnabled, Profile* profile);
// This function (used by UpdateSyncItem) is only exposed for testing.
// Just use UpdateSyncItem() instead.
void UpdateSyncItemForStatus(id syncItem, BOOL syncEnabled,
- SyncStatusUIHelper::MessageType status);
+ sync_ui_util::MessageType status);
-} // namespace browser_sync
+} // namespace sync_ui_util
-#endif // CHROME_BROWSER_SYNC_SYNC_STATUS_UI_HELPER_H_
+#endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_MAC_H_
diff --git a/chrome/browser/sync/sync_status_ui_helper_mac.mm b/chrome/browser/sync/sync_ui_util_mac.mm
index 75d199f..1e04b22 100644
--- a/chrome/browser/sync/sync_status_ui_helper_mac.mm
+++ b/chrome/browser/sync/sync_ui_util_mac.mm
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/sync/sync_status_ui_helper_mac.h"
+#include "chrome/browser/sync/sync_ui_util_mac.h"
#import <Cocoa/Cocoa.h>
#include "app/l10n_util_mac.h"
#include "base/logging.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "grit/generated_resources.h"
-namespace browser_sync {
+namespace sync_ui_util {
void UpdateSyncItem(id syncItem, BOOL syncEnabled, Profile* profile) {
ProfileSyncService* syncService =
@@ -20,13 +20,13 @@ void UpdateSyncItem(id syncItem, BOOL syncEnabled, Profile* profile) {
// TODO(timsteele): Need a ui helper method to just get the type
// without needing labels.
string16 label, link;
- SyncStatusUIHelper::MessageType status =
- SyncStatusUIHelper::GetLabels(syncService, &label, &link);
+ sync_ui_util::MessageType status =
+ sync_ui_util::GetStatusLabels(syncService, &label, &link);
UpdateSyncItemForStatus(syncItem, syncEnabled, status);
}
void UpdateSyncItemForStatus(id syncItem, BOOL syncEnabled,
- SyncStatusUIHelper::MessageType status) {
+ sync_ui_util::MessageType status) {
DCHECK([syncItem isKindOfClass:[NSMenuItem class]]);
NSMenuItem* syncMenuItem = static_cast<NSMenuItem*>(syncItem);
// Look for a separator immediately after the menu item.
@@ -47,13 +47,13 @@ void UpdateSyncItemForStatus(id syncItem, BOOL syncEnabled,
// chrome/browser/views/toolbar_view.cc.
int titleId;
switch (status) {
- case SyncStatusUIHelper::SYNCED:
+ case sync_ui_util::SYNCED:
titleId = IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL;
break;
- case SyncStatusUIHelper::SYNC_ERROR:
+ case sync_ui_util::SYNC_ERROR:
titleId = IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL;
break;
- case SyncStatusUIHelper::PRE_SYNCED:
+ case sync_ui_util::PRE_SYNCED:
titleId = IDS_SYNC_START_SYNC_BUTTON_LABEL;
break;
default:
@@ -72,4 +72,4 @@ void UpdateSyncItemForStatus(id syncItem, BOOL syncEnabled,
[followingSeparator setHidden:!syncEnabled];
}
-} // namespace browser_sync
+} // namespace sync_ui_util
diff --git a/chrome/browser/sync/sync_status_ui_helper_mac_unittest.mm b/chrome/browser/sync/sync_ui_util_mac_unittest.mm
index e5418e1..ebe3bcc 100644
--- a/chrome/browser/sync/sync_status_ui_helper_mac_unittest.mm
+++ b/chrome/browser/sync/sync_ui_util_mac_unittest.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/sync/sync_status_ui_helper_mac.h"
+#include "chrome/browser/sync/sync_ui_util_mac.h"
#import <Cocoa/Cocoa.h>
@@ -35,22 +35,22 @@ TEST_F(SyncStatusUIHelperMacTest, UpdateSyncItem) {
[syncMenuItem setTitle:@""];
[syncMenuItem setHidden:NO];
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, NO,
- SyncStatusUIHelper::PRE_SYNCED);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, NO,
+ sync_ui_util::PRE_SYNCED);
EXPECT_TRUE([[syncMenuItem title] isEqualTo:startSync]);
EXPECT_TRUE([syncMenuItem isHidden]);
[syncMenuItem setTitle:@""];
[syncMenuItem setHidden:YES];
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, YES,
- SyncStatusUIHelper::SYNC_ERROR);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, YES,
+ sync_ui_util::SYNC_ERROR);
EXPECT_TRUE([[syncMenuItem title] isEqualTo:bookmarkSyncError]);
EXPECT_FALSE([syncMenuItem isHidden]);
[syncMenuItem setTitle:@""];
[syncMenuItem setHidden:NO];
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, NO,
- SyncStatusUIHelper::SYNCED);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, NO,
+ sync_ui_util::SYNCED);
EXPECT_TRUE([[syncMenuItem title] isEqualTo:bookmarksSynced]);
EXPECT_TRUE([syncMenuItem isHidden]);
}
@@ -65,19 +65,18 @@ TEST_F(SyncStatusUIHelperMacTest, UpdateSyncItemWithSeparator) {
NSMenuItem* followingSeparator = [NSMenuItem separatorItem];
[menu addItem:followingSeparator];
- const SyncStatusUIHelper::MessageType kStatus =
- SyncStatusUIHelper::PRE_SYNCED;
+ const sync_ui_util::MessageType kStatus = sync_ui_util::PRE_SYNCED;
[syncMenuItem setHidden:NO];
[followingSeparator setHidden:NO];
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, NO, kStatus);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, NO, kStatus);
EXPECT_FALSE([followingSeparator isEnabled]);
EXPECT_TRUE([syncMenuItem isHidden]);
EXPECT_TRUE([followingSeparator isHidden]);
[syncMenuItem setHidden:YES];
[followingSeparator setHidden:YES];
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, YES, kStatus);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, YES, kStatus);
EXPECT_FALSE([followingSeparator isEnabled]);
EXPECT_FALSE([syncMenuItem isHidden]);
EXPECT_FALSE([followingSeparator isHidden]);
@@ -95,14 +94,13 @@ TEST_F(SyncStatusUIHelperMacTest, UpdateSyncItemWithNonSeparator) {
action:@selector(commandDispatch)
keyEquivalent:@""];
- const SyncStatusUIHelper::MessageType kStatus =
- SyncStatusUIHelper::PRE_SYNCED;
+ const sync_ui_util::MessageType kStatus = sync_ui_util::PRE_SYNCED;
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, NO, kStatus);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, NO, kStatus);
EXPECT_TRUE([followingNonSeparator isEnabled]);
EXPECT_FALSE([followingNonSeparator isHidden]);
- browser_sync::UpdateSyncItemForStatus(syncMenuItem, YES, kStatus);
+ sync_ui_util::UpdateSyncItemForStatus(syncMenuItem, YES, kStatus);
EXPECT_TRUE([followingNonSeparator isEnabled]);
EXPECT_FALSE([followingNonSeparator isHidden]);
}
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc
index ebb80e9..3b95041 100644
--- a/chrome/browser/views/bookmark_bar_view.cc
+++ b/chrome/browser/views/bookmark_bar_view.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/view_ids.h"
@@ -1687,10 +1687,10 @@ bool BookmarkBarView::ShouldShowSyncErrorButton() {
if (sync_service_ && sync_service_->HasSyncSetupCompleted()) {
string16 status_text;
string16 link_text;
- SyncStatusUIHelper::MessageType sync_status;
- sync_status = SyncStatusUIHelper::GetLabels(
+ sync_ui_util::MessageType sync_status;
+ sync_status = sync_ui_util::GetStatusLabels(
sync_service_, &status_text, &link_text);
- if (sync_status == SyncStatusUIHelper::SYNC_ERROR) {
+ if (sync_status == sync_ui_util::SYNC_ERROR) {
show_sync_error_button = true;
}
}
diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc
index 30a9d21..2446e8c 100644
--- a/chrome/browser/views/bookmark_manager_view.cc
+++ b/chrome/browser/views/bookmark_manager_view.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/views/bookmark_editor_view.h"
#include "chrome/browser/views/bookmark_folder_tree_view.h"
#include "chrome/browser/views/bookmark_table_view.h"
@@ -512,7 +512,7 @@ void BookmarkManagerView::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == sync_status_button_) {
UserMetrics::RecordAction("BookmarkManager_Sync", profile_);
- SyncStatusUIHelper::OpenSyncMyBookmarksDialog(
+ sync_ui_util::OpenSyncMyBookmarksDialog(
profile_, ProfileSyncService::START_FROM_BOOKMARK_MANAGER);
}
}
@@ -818,8 +818,8 @@ void BookmarkManagerView::UpdateSyncStatus() {
DCHECK(sync_service_);
std::wstring status_label;
std::wstring link_label;
- bool synced = SyncStatusUIHelper::GetLabels(sync_service_,
- &status_label, &link_label) == SyncStatusUIHelper::SYNCED;
+ bool synced = sync_ui_util::GetStatusLabels(sync_service_,
+ &status_label, &link_label) == sync_ui_util::SYNCED;
if (sync_service_->HasSyncSetupCompleted()) {
std::wstring username = sync_service_->GetAuthenticatedUsername();
diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc
index 17dd616..3189919 100644
--- a/chrome/browser/views/options/content_page_view.cc
+++ b/chrome/browser/views/options/content_page_view.cc
@@ -17,7 +17,7 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_window.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/views/clear_browsing_data.h"
#include "chrome/browser/views/importer_view.h"
#include "chrome/browser/views/options/options_group_view.h"
@@ -458,8 +458,8 @@ void ContentPageView::UpdateSyncControls() {
std::wstring link_label;
std::wstring button_label;
bool sync_setup_completed = sync_service_->HasSyncSetupCompleted();
- bool status_has_error = SyncStatusUIHelper::GetLabels(sync_service_,
- &status_label, &link_label) == SyncStatusUIHelper::SYNC_ERROR;
+ bool status_has_error = sync_ui_util::GetStatusLabels(sync_service_,
+ &status_label, &link_label) == sync_ui_util::SYNC_ERROR;
if (sync_setup_completed) {
button_label = l10n_util::GetString(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
} else if (sync_service_->SetupInProgress()) {
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 736b1ee..29a1e7a 100644
--- a/chrome/browser/views/toolbar_view.cc
+++ b/chrome/browser/views/toolbar_view.cc
@@ -28,7 +28,7 @@
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/sync_status_ui_helper.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/user_data_manager.h"
@@ -1183,12 +1183,12 @@ void ToolbarView::CreateAppMenu() {
string16 link;
// TODO(timsteele): Need a ui helper method to just get the type without
// needing labels.
- SyncStatusUIHelper::MessageType type = SyncStatusUIHelper::GetLabels(
+ sync_ui_util::MessageType type = sync_ui_util::GetStatusLabels(
browser_->profile()->GetOriginalProfile()->GetProfileSyncService(),
&label, &link);
- label = type == SyncStatusUIHelper::SYNCED ?
+ label = type == sync_ui_util::SYNCED ?
l10n_util::GetStringUTF16(IDS_SYNC_MENU_BOOKMARKS_SYNCED_LABEL) :
- type == SyncStatusUIHelper::SYNC_ERROR ?
+ type == sync_ui_util::SYNC_ERROR ?
l10n_util::GetStringUTF16(IDS_SYNC_MENU_BOOKMARK_SYNC_ERROR_LABEL) :
l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
app_menu_contents_->AddItem(IDC_SYNC_BOOKMARKS, label);
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 86e1ec4..f4dc3c6 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2192,10 +2192,10 @@
'browser/sync/sync_setup_flow.h',
'browser/sync/sync_setup_wizard.cc',
'browser/sync/sync_setup_wizard.h',
- 'browser/sync/sync_status_ui_helper.cc',
- 'browser/sync/sync_status_ui_helper.h',
- 'browser/sync/sync_status_ui_helper_mac.mm',
- 'browser/sync/sync_status_ui_helper_mac.h',
+ 'browser/sync/sync_ui_util.cc',
+ 'browser/sync/sync_ui_util.h',
+ 'browser/sync/sync_ui_util_mac.mm',
+ 'browser/sync/sync_ui_util_mac.h',
'browser/state_tracker.cc',
'browser/state_tracker.h',
'browser/tab_contents/constrained_window.h',
@@ -4767,7 +4767,7 @@
'browser/sync/glue/http_bridge_unittest.cc',
'browser/sync/profile_sync_service_unittest.cc',
'browser/sync/sync_setup_wizard_unittest.cc',
- 'browser/sync/sync_status_ui_helper_mac_unittest.mm',
+ 'browser/sync/sync_ui_util_mac_unittest.mm',
'browser/tab_contents/navigation_controller_unittest.cc',
'browser/tab_contents/navigation_entry_unittest.cc',
'browser/tab_contents/render_view_host_manager_unittest.cc',