OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/sync/sync_error_notifier_ash.h" | 5 #include "chrome/browser/sync/sync_error_notifier_ash.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/system/system_notifier.h" | 9 #include "ash/system/system_notifier.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 Profile* profile); | 45 Profile* profile); |
46 | 46 |
47 // NotificationDelegate: | 47 // NotificationDelegate: |
48 virtual void Display() OVERRIDE; | 48 virtual void Display() OVERRIDE; |
49 virtual void Error() OVERRIDE; | 49 virtual void Error() OVERRIDE; |
50 virtual void Close(bool by_user) OVERRIDE; | 50 virtual void Close(bool by_user) OVERRIDE; |
51 virtual bool HasClickedListener() OVERRIDE; | 51 virtual bool HasClickedListener() OVERRIDE; |
52 virtual void Click() OVERRIDE; | 52 virtual void Click() OVERRIDE; |
53 virtual void ButtonClick(int button_index) OVERRIDE; | 53 virtual void ButtonClick(int button_index) OVERRIDE; |
54 virtual std::string id() const OVERRIDE; | 54 virtual std::string id() const OVERRIDE; |
55 virtual content::WebContents* GetWebContents() const OVERRIDE; | |
56 | 55 |
57 protected: | 56 protected: |
58 virtual ~SyncNotificationDelegate(); | 57 virtual ~SyncNotificationDelegate(); |
59 | 58 |
60 private: | 59 private: |
61 void ShowSyncSetup(); | 60 void ShowSyncSetup(); |
62 | 61 |
63 // Unique id of the notification. | 62 // Unique id of the notification. |
64 const std::string id_; | 63 const std::string id_; |
65 | 64 |
(...skipping 30 matching lines...) Expand all Loading... |
96 } | 95 } |
97 | 96 |
98 void SyncNotificationDelegate::ButtonClick(int button_index) { | 97 void SyncNotificationDelegate::ButtonClick(int button_index) { |
99 ShowSyncSetup(); | 98 ShowSyncSetup(); |
100 } | 99 } |
101 | 100 |
102 std::string SyncNotificationDelegate::id() const { | 101 std::string SyncNotificationDelegate::id() const { |
103 return id_; | 102 return id_; |
104 } | 103 } |
105 | 104 |
106 content::WebContents* SyncNotificationDelegate::GetWebContents() const { | |
107 return NULL; | |
108 } | |
109 | |
110 void SyncNotificationDelegate::ShowSyncSetup() { | 105 void SyncNotificationDelegate::ShowSyncSetup() { |
111 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); | 106 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); |
112 if (login_ui->current_login_ui()) { | 107 if (login_ui->current_login_ui()) { |
113 // TODO(michaelpg): The LoginUI might be on an inactive desktop. | 108 // TODO(michaelpg): The LoginUI might be on an inactive desktop. |
114 // See crbug.com/354280. | 109 // See crbug.com/354280. |
115 login_ui->current_login_ui()->FocusUI(); | 110 login_ui->current_login_ui()->FocusUI(); |
116 return; | 111 return; |
117 } | 112 } |
118 | 113 |
119 chrome::ShowSettingsSubPageForProfile(profile_, chrome::kSyncSetupSubPage); | 114 chrome::ShowSettingsSubPageForProfile(profile_, chrome::kSyncSetupSubPage); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 192 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
198 IDR_NOTIFICATION_ALERT), | 193 IDR_NOTIFICATION_ALERT), |
199 blink::WebTextDirectionDefault, | 194 blink::WebTextDirectionDefault, |
200 notifier_id, | 195 notifier_id, |
201 base::string16(), // display_source | 196 base::string16(), // display_source |
202 base::ASCIIToUTF16(notification_id_), | 197 base::ASCIIToUTF16(notification_id_), |
203 data, | 198 data, |
204 delegate); | 199 delegate); |
205 notification_ui_manager->Add(notification, profile_); | 200 notification_ui_manager->Add(notification, profile_); |
206 } | 201 } |
OLD | NEW |