OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/printing/cloud_print/cloud_print_proxy_service.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // If we already have a pending notification, don't show another one. | 105 // If we already have a pending notification, don't show another one. |
106 if (token_expired_delegate_.get()) | 106 if (token_expired_delegate_.get()) |
107 return false; | 107 return false; |
108 | 108 |
109 // TODO(sanjeevr): Get icon for this notification. | 109 // TODO(sanjeevr): Get icon for this notification. |
110 GURL icon_url; | 110 GURL icon_url; |
111 | 111 |
112 string16 title = UTF8ToUTF16(kCloudPrintProductName); | 112 string16 title = UTF8ToUTF16(kCloudPrintProductName); |
113 string16 message = | 113 string16 message = |
114 l10n_util::GetStringUTF16(IDS_CLOUD_PRINT_TOKEN_EXPIRED_MESSAGE); | 114 l10n_util::GetStringUTF16(IDS_CLOUD_PRINT_TOKEN_EXPIRED_MESSAGE); |
115 string16 content_url = DesktopNotificationService::CreateDataUrl( | 115 DesktopNotificationService::ShowBalloon( |
116 icon_url, title, message, WebKit::WebTextDirectionDefault); | 116 GURL(), icon_url, title, message, token_expired_delegate_.get(), |
117 token_expired_delegate_ = new TokenExpiredNotificationDelegate(this); | 117 profile_); |
118 Notification notification(GURL(), GURL(content_url), string16(), string16(), | |
119 token_expired_delegate_.get()); | |
120 g_browser_process->notification_ui_manager()->Add(notification, profile_); | |
121 // Keep the browser alive while we are showing the notification. | 118 // Keep the browser alive while we are showing the notification. |
122 BrowserList::StartKeepAlive(); | 119 BrowserList::StartKeepAlive(); |
123 return true; | 120 return true; |
124 } | 121 } |
125 | 122 |
126 void CloudPrintProxyService::OnTokenExpiredNotificationError() { | 123 void CloudPrintProxyService::OnTokenExpiredNotificationError() { |
127 TokenExpiredNotificationDone(false); | 124 TokenExpiredNotificationDone(false); |
128 } | 125 } |
129 | 126 |
130 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) { | 127 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 207 } |
211 | 208 |
212 bool CloudPrintProxyService::InvokeServiceTask(Task* task) { | 209 bool CloudPrintProxyService::InvokeServiceTask(Task* task) { |
213 ServiceProcessControl* process_control = | 210 ServiceProcessControl* process_control = |
214 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_); | 211 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_); |
215 DCHECK(process_control); | 212 DCHECK(process_control); |
216 if (process_control) | 213 if (process_control) |
217 process_control->Launch(task, NULL); | 214 process_control->Launch(task, NULL); |
218 return !!process_control; | 215 return !!process_control; |
219 } | 216 } |
OLD | NEW |