Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Unified Diff: chrome/browser/sync/sync_global_error.cc

Issue 7906013: Show bubble and wrench menu item for sync error (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor into sync_ui_util Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/sync_global_error.cc
diff --git a/chrome/browser/sync/sync_global_error.cc b/chrome/browser/sync/sync_global_error.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5e23e1d952e30de94709dc74bacaea7f2971b844
--- /dev/null
+++ b/chrome/browser/sync/sync_global_error.cc
@@ -0,0 +1,102 @@
+// Copyright (c) 2011 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.
+
+#include "chrome/browser/sync/sync_global_error.h"
+
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/sync/profile_sync_service_observer.h"
+#include "chrome/browser/sync/sync_ui_util.h"
+#include "chrome/common/net/gaia/google_service_auth_error.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+typedef GoogleServiceAuthError AuthError;
+
+using namespace sync_ui_util;
+
+SyncGlobalError::SyncGlobalError(ProfileSyncService* service)
+ : service_(service) {
+ OnStateChanged();
+}
+
+SyncGlobalError::~SyncGlobalError() {
+}
+
+bool SyncGlobalError::HasBadge() {
+#if defined(OS_CHROMEOS)
+ // TODO(sail): Due to http://crbug.com/96608 we don't have a wrench menu
+ // item on ChromeOS thus we don't badge the wrench menu either.
+ return false;
+#else
+ return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
+ SYNC_ERROR;
+#endif
+}
+
+bool SyncGlobalError::HasMenuItem() {
+ // TODO(sail): Once http://crbug.com/96608 is fixed this should return
+ // true for ChromeOS.
+ return false;
+}
+
+int SyncGlobalError::MenuItemCommandID() {
+ NOTREACHED();
+ return 0;
+}
+
+string16 SyncGlobalError::MenuItemLabel() {
+ string16 label;
+ GetStatusLabelsForSyncGlobalError(service_, &label, NULL, NULL);
+ return label;
+}
+
+void SyncGlobalError::ExecuteMenuItem(Browser* browser) {
+ service_->ShowErrorUI();
+}
+
+bool SyncGlobalError::HasBubbleView() {
+ return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
+ SYNC_ERROR;
+}
+
+string16 SyncGlobalError::GetBubbleViewTitle() {
+ return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE);
+}
+
+string16 SyncGlobalError::GetBubbleViewMessage() {
+ string16 label;
+ GetStatusLabelsForSyncGlobalError(service_, NULL, &label, NULL);
+ return label;
+}
+
+string16 SyncGlobalError::GetBubbleViewAcceptButtonLabel() {
+ string16 label;
+ GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, &label);
+ return label;
+}
+
+string16 SyncGlobalError::GetBubbleViewCancelButtonLabel() {
+ return string16();
+}
+
+void SyncGlobalError::BubbleViewDidClose() {
+}
+
+void SyncGlobalError::BubbleViewAcceptButtonPressed() {
+ service_->ShowErrorUI();
+}
+
+void SyncGlobalError::BubbleViewCancelButtonPressed() {
+ NOTREACHED();
+}
+
+void SyncGlobalError::OnStateChanged() {
+ // TODO(sail): Update the wrench menu button.
+}
+
+bool SyncGlobalError::HasCustomizedSyncMenuItem() {
+ return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
+ SYNC_ERROR;
+}

Powered by Google App Engine
This is Rietveld 408576698