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

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

Issue 6685008: Cloud print signin crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase past Windows views options removal. Created 9 years, 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
11 #include "chrome/browser/browser_list.h" 11 #include "chrome/browser/browser_list.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/notifications/desktop_notification_service.h" 13 #include "chrome/browser/notifications/desktop_notification_service.h"
14 #include "chrome/browser/notifications/notification.h" 14 #include "chrome/browser/notifications/notification.h"
15 #include "chrome/browser/notifications/notification_ui_manager.h" 15 #include "chrome/browser/notifications/notification_ui_manager.h"
16 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/service/service_process_control.h" 19 #include "chrome/browser/service/service_process_control.h"
19 #include "chrome/browser/service/service_process_control_manager.h" 20 #include "chrome/browser/service/service_process_control_manager.h"
20 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
21 #include "chrome/common/service_messages.h" 22 #include "chrome/common/service_messages.h"
22 #include "content/browser/browser_thread.h" 23 #include "content/browser/browser_thread.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
25 26
26 // TODO(sanjeevr): Localize the product name? 27 // TODO(sanjeevr): Localize the product name?
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 114
114 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) { 115 void CloudPrintProxyService::OnTokenExpiredNotificationClosed(bool by_user) {
115 TokenExpiredNotificationDone(false); 116 TokenExpiredNotificationDone(false);
116 } 117 }
117 118
118 void CloudPrintProxyService::OnTokenExpiredNotificationClick() { 119 void CloudPrintProxyService::OnTokenExpiredNotificationClick() {
119 TokenExpiredNotificationDone(true); 120 TokenExpiredNotificationDone(true);
120 // Clear the cached cloud print email pref so that the cloud print setup 121 // Clear the cached cloud print email pref so that the cloud print setup
121 // flow happens. 122 // flow happens.
122 profile_->GetPrefs()->SetString(prefs::kCloudPrintEmail, std::string()); 123 profile_->GetPrefs()->SetString(prefs::kCloudPrintEmail, std::string());
123 CloudPrintSetupFlow::OpenDialog(profile_, this, NULL); 124 cloud_print_setup_handler_.reset(new CloudPrintSetupHandler(this));
125 CloudPrintSetupFlow::OpenDialog(
126 profile_, cloud_print_setup_handler_->AsWeakPtr(), NULL);
124 } 127 }
125 128
126 void CloudPrintProxyService::TokenExpiredNotificationDone(bool keep_alive) { 129 void CloudPrintProxyService::TokenExpiredNotificationDone(bool keep_alive) {
127 if (token_expired_delegate_.get()) { 130 if (token_expired_delegate_.get()) {
128 g_browser_process->notification_ui_manager()->CancelById( 131 g_browser_process->notification_ui_manager()->CancelById(
129 token_expired_delegate_->id()); 132 token_expired_delegate_->id());
130 token_expired_delegate_ = NULL; 133 token_expired_delegate_ = NULL;
131 if (!keep_alive) 134 if (!keep_alive)
132 BrowserList::EndKeepAlive(); 135 BrowserList::EndKeepAlive();
133 } 136 }
134 } 137 }
135 138
136 void CloudPrintProxyService::OnDialogClosed() { 139 void CloudPrintProxyService::OnCloudPrintSetupClosed() {
137 MessageLoop::current()->PostTask( 140 MessageLoop::current()->PostTask(
138 FROM_HERE, NewRunnableFunction(&BrowserList::EndKeepAlive)); 141 FROM_HERE, NewRunnableFunction(&BrowserList::EndKeepAlive));
139 } 142 }
140 143
141 void CloudPrintProxyService::RefreshCloudPrintProxyStatus() { 144 void CloudPrintProxyService::RefreshCloudPrintProxyStatus() {
142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
143 ServiceProcessControl* process_control = 146 ServiceProcessControl* process_control =
144 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_); 147 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_);
145 DCHECK(process_control->is_connected()); 148 DCHECK(process_control->is_connected());
146 Callback2<bool, std::string>::Type* callback = 149 Callback2<bool, std::string>::Type* callback =
(...skipping 27 matching lines...) Expand all
174 } 177 }
175 178
176 bool CloudPrintProxyService::InvokeServiceTask(Task* task) { 179 bool CloudPrintProxyService::InvokeServiceTask(Task* task) {
177 ServiceProcessControl* process_control = 180 ServiceProcessControl* process_control =
178 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_); 181 ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_);
179 DCHECK(process_control); 182 DCHECK(process_control);
180 if (process_control) 183 if (process_control)
181 process_control->Launch(task, NULL); 184 process_control->Launch(task, NULL);
182 return !!process_control; 185 return !!process_control;
183 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698