| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual bool HasClickedListener() OVERRIDE; | 50 virtual bool HasClickedListener() OVERRIDE; |
| 51 virtual void Click() OVERRIDE; | 51 virtual void Click() OVERRIDE; |
| 52 virtual void ButtonClick(int button_index) OVERRIDE; | 52 virtual void ButtonClick(int button_index) OVERRIDE; |
| 53 virtual std::string id() const OVERRIDE; | 53 virtual std::string id() const OVERRIDE; |
| 54 virtual content::WebContents* GetWebContents() const OVERRIDE; | 54 virtual content::WebContents* GetWebContents() const OVERRIDE; |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 virtual ~SyncNotificationDelegate(); | 57 virtual ~SyncNotificationDelegate(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 void ShowSyncSetup(); |
| 61 |
| 60 // Unique id of the notification. | 62 // Unique id of the notification. |
| 61 const std::string id_; | 63 const std::string id_; |
| 62 | 64 |
| 63 Profile* profile_; | 65 Profile* profile_; |
| 64 | 66 |
| 65 DISALLOW_COPY_AND_ASSIGN(SyncNotificationDelegate); | 67 DISALLOW_COPY_AND_ASSIGN(SyncNotificationDelegate); |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 SyncNotificationDelegate::SyncNotificationDelegate( | 70 SyncNotificationDelegate::SyncNotificationDelegate( |
| 69 const std::string& id, | 71 const std::string& id, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 82 } | 84 } |
| 83 | 85 |
| 84 void SyncNotificationDelegate::Close(bool by_user) { | 86 void SyncNotificationDelegate::Close(bool by_user) { |
| 85 } | 87 } |
| 86 | 88 |
| 87 bool SyncNotificationDelegate::HasClickedListener() { | 89 bool SyncNotificationDelegate::HasClickedListener() { |
| 88 return false; | 90 return false; |
| 89 } | 91 } |
| 90 | 92 |
| 91 void SyncNotificationDelegate::Click() { | 93 void SyncNotificationDelegate::Click() { |
| 94 ShowSyncSetup(); |
| 95 } |
| 96 |
| 97 void SyncNotificationDelegate::ButtonClick(int button_index) { |
| 98 ShowSyncSetup(); |
| 92 } | 99 } |
| 93 | 100 |
| 94 std::string SyncNotificationDelegate::id() const { | 101 std::string SyncNotificationDelegate::id() const { |
| 95 return id_; | 102 return id_; |
| 96 } | 103 } |
| 97 | 104 |
| 98 content::WebContents* SyncNotificationDelegate::GetWebContents() const { | 105 content::WebContents* SyncNotificationDelegate::GetWebContents() const { |
| 99 return NULL; | 106 return NULL; |
| 100 } | 107 } |
| 101 | 108 |
| 102 void SyncNotificationDelegate::ButtonClick(int button_index) { | 109 void SyncNotificationDelegate::ShowSyncSetup() { |
| 103 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); | 110 LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); |
| 104 if (login_ui->current_login_ui()) { | 111 if (login_ui->current_login_ui()) { |
| 105 // TODO(michaelpg): The LoginUI might be on an inactive desktop. | 112 // TODO(michaelpg): The LoginUI might be on an inactive desktop. |
| 106 // See crbug.com/354280. | 113 // See crbug.com/354280. |
| 107 login_ui->current_login_ui()->FocusUI(); | 114 login_ui->current_login_ui()->FocusUI(); |
| 108 return; | 115 return; |
| 109 } | 116 } |
| 110 | 117 |
| 111 chrome::ShowSettingsSubPageForProfile(profile_, chrome::kSyncSetupSubPage); | 118 chrome::ShowSettingsSubPageForProfile(profile_, chrome::kSyncSetupSubPage); |
| 112 } | 119 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 196 ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 190 IDR_NOTIFICATION_ALERT), | 197 IDR_NOTIFICATION_ALERT), |
| 191 blink::WebTextDirectionDefault, | 198 blink::WebTextDirectionDefault, |
| 192 notifier_id, | 199 notifier_id, |
| 193 base::string16(), // display_source | 200 base::string16(), // display_source |
| 194 base::ASCIIToUTF16(notification_id_), | 201 base::ASCIIToUTF16(notification_id_), |
| 195 data, | 202 data, |
| 196 delegate); | 203 delegate); |
| 197 notification_ui_manager->Add(notification, profile_); | 204 notification_ui_manager->Add(notification, profile_); |
| 198 } | 205 } |
| OLD | NEW |