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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_service.cc

Issue 7053041: Add a Create method to DesktopNotificationHandler and stubs for the notification objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try to fix trybot failures and address torne's comments. Created 9 years, 6 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
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // If we already have a pending notification, don't show another one. 104 // If we already have a pending notification, don't show another one.
105 if (token_expired_delegate_.get()) 105 if (token_expired_delegate_.get())
106 return false; 106 return false;
107 107
108 // TODO(sanjeevr): Get icon for this notification. 108 // TODO(sanjeevr): Get icon for this notification.
109 GURL icon_url; 109 GURL icon_url;
110 110
111 string16 title = UTF8ToUTF16(kCloudPrintProductName); 111 string16 title = UTF8ToUTF16(kCloudPrintProductName);
112 string16 message = 112 string16 message =
113 l10n_util::GetStringUTF16(IDS_CLOUD_PRINT_TOKEN_EXPIRED_MESSAGE); 113 l10n_util::GetStringUTF16(IDS_CLOUD_PRINT_TOKEN_EXPIRED_MESSAGE);
114 string16 content_url = DesktopNotificationService::CreateDataUrl( 114 DesktopNotificationService::ShowBalloon(
115 icon_url, title, message, WebKit::WebTextDirectionDefault); 115 GURL(), icon_url, title, message, token_expired_delegate_.get(),
116 token_expired_delegate_ = new TokenExpiredNotificationDelegate(this); 116 profile_);
117 Notification notification(GURL(), GURL(content_url), string16(), string16(),
118 token_expired_delegate_.get());
119 g_browser_process->notification_ui_manager()->Add(notification, profile_);
120 // Keep the browser alive while we are showing the notification. 117 // Keep the browser alive while we are showing the notification.
121 BrowserList::StartKeepAlive(); 118 BrowserList::StartKeepAlive();
122 return true; 119 return true;
123 } 120 }
124 121
125 void CloudPrintProxyService::OnTokenExpiredNotificationError() { 122 void CloudPrintProxyService::OnTokenExpiredNotificationError() {
126 TokenExpiredNotificationDone(false); 123 TokenExpiredNotificationDone(false);
127 } 124 }
128 125
129 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) { 126 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const cloud_print::CloudPrintProxyInfo& proxy_info) { 198 const cloud_print::CloudPrintProxyInfo& proxy_info) {
202 profile_->GetPrefs()->SetString( 199 profile_->GetPrefs()->SetString(
203 prefs::kCloudPrintEmail, 200 prefs::kCloudPrintEmail,
204 proxy_info.enabled ? proxy_info.email : std::string()); 201 proxy_info.enabled ? proxy_info.email : std::string());
205 } 202 }
206 203
207 bool CloudPrintProxyService::InvokeServiceTask(Task* task) { 204 bool CloudPrintProxyService::InvokeServiceTask(Task* task) {
208 ServiceProcessControl::GetInstance()->Launch(task, NULL); 205 ServiceProcessControl::GetInstance()->Launch(task, NULL);
209 return true; 206 return true;
210 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698