OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/first_run/drive_first_run_controller.h" | 5 #include "chrome/browser/chromeos/first_run/drive_first_run_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // NotificationDelegate for the notification that is displayed when Drive | 78 // NotificationDelegate for the notification that is displayed when Drive |
79 // offline mode is enabled automatically. Clicking on the notification button | 79 // offline mode is enabled automatically. Clicking on the notification button |
80 // will open the Drive settings page. | 80 // will open the Drive settings page. |
81 class DriveOfflineNotificationDelegate | 81 class DriveOfflineNotificationDelegate |
82 : public message_center::NotificationDelegate { | 82 : public message_center::NotificationDelegate { |
83 public: | 83 public: |
84 explicit DriveOfflineNotificationDelegate(Profile* profile) | 84 explicit DriveOfflineNotificationDelegate(Profile* profile) |
85 : profile_(profile) {} | 85 : profile_(profile) {} |
86 | 86 |
87 // message_center::NotificationDelegate overrides: | 87 // message_center::NotificationDelegate overrides: |
88 virtual void Display() OVERRIDE {} | 88 virtual void Display() override {} |
89 virtual void Error() OVERRIDE {} | 89 virtual void Error() override {} |
90 virtual void Close(bool by_user) OVERRIDE {} | 90 virtual void Close(bool by_user) override {} |
91 virtual void Click() OVERRIDE {} | 91 virtual void Click() override {} |
92 virtual void ButtonClick(int button_index) OVERRIDE; | 92 virtual void ButtonClick(int button_index) override; |
93 | 93 |
94 protected: | 94 protected: |
95 virtual ~DriveOfflineNotificationDelegate() {} | 95 virtual ~DriveOfflineNotificationDelegate() {} |
96 | 96 |
97 private: | 97 private: |
98 Profile* profile_; | 98 Profile* profile_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(DriveOfflineNotificationDelegate); | 100 DISALLOW_COPY_AND_ASSIGN(DriveOfflineNotificationDelegate); |
101 }; | 101 }; |
102 | 102 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Runs |completion_callback|. | 150 // Runs |completion_callback|. |
151 void RunCompletionCallback(bool success, | 151 void RunCompletionCallback(bool success, |
152 DriveFirstRunController::UMAOutcome outcome); | 152 DriveFirstRunController::UMAOutcome outcome); |
153 | 153 |
154 // content::WebContentsObserver overrides: | 154 // content::WebContentsObserver overrides: |
155 virtual void DidFailProvisionalLoad( | 155 virtual void DidFailProvisionalLoad( |
156 content::RenderFrameHost* render_frame_host, | 156 content::RenderFrameHost* render_frame_host, |
157 const GURL& validated_url, | 157 const GURL& validated_url, |
158 int error_code, | 158 int error_code, |
159 const base::string16& error_description) OVERRIDE; | 159 const base::string16& error_description) override; |
160 | 160 |
161 virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, | 161 virtual void DidFailLoad(content::RenderFrameHost* render_frame_host, |
162 const GURL& validated_url, | 162 const GURL& validated_url, |
163 int error_code, | 163 int error_code, |
164 const base::string16& error_description) OVERRIDE; | 164 const base::string16& error_description) override; |
165 | 165 |
166 // content::WebContentsDelegate overrides: | 166 // content::WebContentsDelegate overrides: |
167 virtual bool ShouldCreateWebContents( | 167 virtual bool ShouldCreateWebContents( |
168 content::WebContents* web_contents, | 168 content::WebContents* web_contents, |
169 int route_id, | 169 int route_id, |
170 WindowContainerType window_container_type, | 170 WindowContainerType window_container_type, |
171 const base::string16& frame_name, | 171 const base::string16& frame_name, |
172 const GURL& target_url, | 172 const GURL& target_url, |
173 const std::string& partition_id, | 173 const std::string& partition_id, |
174 content::SessionStorageNamespace* session_storage_namespace) OVERRIDE; | 174 content::SessionStorageNamespace* session_storage_namespace) override; |
175 | 175 |
176 // content::NotificationObserver overrides: | 176 // content::NotificationObserver overrides: |
177 virtual void Observe(int type, | 177 virtual void Observe(int type, |
178 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
179 const content::NotificationDetails& details) OVERRIDE; | 179 const content::NotificationDetails& details) override; |
180 | 180 |
181 Profile* profile_; | 181 Profile* profile_; |
182 const std::string app_id_; | 182 const std::string app_id_; |
183 const std::string endpoint_url_; | 183 const std::string endpoint_url_; |
184 scoped_ptr<content::WebContents> web_contents_; | 184 scoped_ptr<content::WebContents> web_contents_; |
185 content::NotificationRegistrar registrar_; | 185 content::NotificationRegistrar registrar_; |
186 bool started_; | 186 bool started_; |
187 CompletionCallback completion_callback_; | 187 CompletionCallback completion_callback_; |
188 base::WeakPtrFactory<DriveWebContentsManager> weak_ptr_factory_; | 188 base::WeakPtrFactory<DriveWebContentsManager> weak_ptr_factory_; |
189 | 189 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 base::UTF8ToUTF16(extension->name()), | 470 base::UTF8ToUTF16(extension->name()), |
471 message_center::NotifierId(message_center::NotifierId::APPLICATION, | 471 message_center::NotifierId(message_center::NotifierId::APPLICATION, |
472 kDriveHostedAppId), | 472 kDriveHostedAppId), |
473 data, | 473 data, |
474 new DriveOfflineNotificationDelegate(profile_))); | 474 new DriveOfflineNotificationDelegate(profile_))); |
475 notification->set_priority(message_center::LOW_PRIORITY); | 475 notification->set_priority(message_center::LOW_PRIORITY); |
476 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 476 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
477 } | 477 } |
478 | 478 |
479 } // namespace chromeos | 479 } // namespace chromeos |
OLD | NEW |