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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/sync_global_error.h"
6
7 #include "chrome/browser/sync/profile_sync_service.h"
8 #include "chrome/browser/sync/profile_sync_service_observer.h"
9 #include "chrome/browser/sync/sync_ui_util.h"
10 #include "chrome/common/net/gaia/google_service_auth_error.h"
11 #include "grit/chromium_strings.h"
12 #include "grit/generated_resources.h"
13 #include "ui/base/l10n/l10n_util.h"
14
15 typedef GoogleServiceAuthError AuthError;
16
17 using namespace sync_ui_util;
18
19 SyncGlobalError::SyncGlobalError(ProfileSyncService* service)
20 : service_(service) {
21 OnStateChanged();
22 }
23
24 SyncGlobalError::~SyncGlobalError() {
25 }
26
27 bool SyncGlobalError::HasBadge() {
28 #if defined(OS_CHROMEOS)
29 // TODO(sail): Due to http://crbug.com/96608 we don't have a wrench menu
30 // item on ChromeOS thus we don't badge the wrench menu either.
31 return false;
32 #else
33 return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
34 SYNC_ERROR;
35 #endif
36 }
37
38 bool SyncGlobalError::HasMenuItem() {
39 // TODO(sail): Once http://crbug.com/96608 is fixed this should return
40 // true for ChromeOS.
41 return false;
42 }
43
44 int SyncGlobalError::MenuItemCommandID() {
45 NOTREACHED();
46 return 0;
47 }
48
49 string16 SyncGlobalError::MenuItemLabel() {
50 string16 label;
51 GetStatusLabelsForSyncGlobalError(service_, &label, NULL, NULL);
52 return label;
53 }
54
55 void SyncGlobalError::ExecuteMenuItem(Browser* browser) {
56 service_->ShowErrorUI();
57 }
58
59 bool SyncGlobalError::HasBubbleView() {
60 return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
61 SYNC_ERROR;
62 }
63
64 string16 SyncGlobalError::GetBubbleViewTitle() {
65 return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_BUBBLE_VIEW_TITLE);
66 }
67
68 string16 SyncGlobalError::GetBubbleViewMessage() {
69 string16 label;
70 GetStatusLabelsForSyncGlobalError(service_, NULL, &label, NULL);
71 return label;
72 }
73
74 string16 SyncGlobalError::GetBubbleViewAcceptButtonLabel() {
75 string16 label;
76 GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, &label);
77 return label;
78 }
79
80 string16 SyncGlobalError::GetBubbleViewCancelButtonLabel() {
81 return string16();
82 }
83
84 void SyncGlobalError::BubbleViewDidClose() {
85 }
86
87 void SyncGlobalError::BubbleViewAcceptButtonPressed() {
88 service_->ShowErrorUI();
89 }
90
91 void SyncGlobalError::BubbleViewCancelButtonPressed() {
92 NOTREACHED();
93 }
94
95 void SyncGlobalError::OnStateChanged() {
96 // TODO(sail): Update the wrench menu button.
97 }
98
99 bool SyncGlobalError::HasCustomizedSyncMenuItem() {
100 return GetStatusLabelsForSyncGlobalError(service_, NULL, NULL, NULL) ==
101 SYNC_ERROR;
102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698