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

Side by Side Diff: chrome/browser/service/service_process_control.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/service/service_process_control.h" 5 #include "chrome/browser/service/service_process_control.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/upgrade_detector.h" 14 #include "chrome/browser/upgrade_detector.h"
15 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/service_messages.h" 17 #include "chrome/common/service_messages.h"
17 #include "chrome/common/service_process_util.h" 18 #include "chrome/common/service_process_util.h"
18 #include "content/browser/browser_thread.h" 19 #include "content/browser/browser_thread.h"
19 #include "content/common/child_process_host.h" 20 #include "content/common/child_process_host.h"
20 #include "content/common/notification_service.h" 21 #include "content/common/notification_service.h"
21 #include "ui/base/ui_base_switches.h" 22 #include "ui/base/ui_base_switches.h"
22 23
23 24
24 // ServiceProcessControl implementation. 25 // ServiceProcessControl implementation.
25 ServiceProcessControl::ServiceProcessControl() { 26 ServiceProcessControl::ServiceProcessControl() {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 198
198 void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { 199 void ServiceProcessControl::OnChannelConnected(int32 peer_pid) {
199 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
200 201
201 // We just established a channel with the service process. Notify it if an 202 // We just established a channel with the service process. Notify it if an
202 // upgrade is available. 203 // upgrade is available.
203 if (UpgradeDetector::GetInstance()->notify_upgrade()) { 204 if (UpgradeDetector::GetInstance()->notify_upgrade()) {
204 Send(new ServiceMsg_UpdateAvailable); 205 Send(new ServiceMsg_UpdateAvailable);
205 } else { 206 } else {
206 if (registrar_.IsEmpty()) 207 if (registrar_.IsEmpty())
207 registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, 208 registrar_.Add(this, chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
208 NotificationService::AllSources()); 209 NotificationService::AllSources());
209 } 210 }
210 RunConnectDoneTasks(); 211 RunConnectDoneTasks();
211 } 212 }
212 213
213 void ServiceProcessControl::OnChannelError() { 214 void ServiceProcessControl::OnChannelError() {
214 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
215 channel_.reset(); 216 channel_.reset();
216 RunConnectDoneTasks(); 217 RunConnectDoneTasks();
217 } 218 }
218 219
219 bool ServiceProcessControl::Send(IPC::Message* message) { 220 bool ServiceProcessControl::Send(IPC::Message* message) {
220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 221 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
221 if (!channel_.get()) 222 if (!channel_.get())
222 return false; 223 return false;
223 return channel_->Send(message); 224 return channel_->Send(message);
224 } 225 }
225 226
226 // NotificationObserver implementation. 227 // NotificationObserver implementation.
227 void ServiceProcessControl::Observe(NotificationType type, 228 void ServiceProcessControl::Observe(int type,
228 const NotificationSource& source, 229 const NotificationSource& source,
229 const NotificationDetails& details) { 230 const NotificationDetails& details) {
230 if (type == NotificationType::UPGRADE_RECOMMENDED) { 231 if (type == chrome::NOTIFICATION_UPGRADE_RECOMMENDED) {
231 Send(new ServiceMsg_UpdateAvailable); 232 Send(new ServiceMsg_UpdateAvailable);
232 } 233 }
233 } 234 }
234 235
235 void ServiceProcessControl::OnCloudPrintProxyInfo( 236 void ServiceProcessControl::OnCloudPrintProxyInfo(
236 const cloud_print::CloudPrintProxyInfo& proxy_info) { 237 const cloud_print::CloudPrintProxyInfo& proxy_info) {
237 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
238 if (cloud_print_info_callback_ != NULL) { 239 if (cloud_print_info_callback_ != NULL) {
239 cloud_print_info_callback_->Run(proxy_info); 240 cloud_print_info_callback_->Run(proxy_info);
240 cloud_print_info_callback_.reset(); 241 cloud_print_info_callback_.reset();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 if (base::LaunchApp(*cmd_line_, false, true, NULL)) { 315 if (base::LaunchApp(*cmd_line_, false, true, NULL)) {
315 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 316 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
316 NewRunnableMethod(this, 317 NewRunnableMethod(this,
317 &Launcher::DoDetectLaunched)); 318 &Launcher::DoDetectLaunched));
318 } else { 319 } else {
319 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 320 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
320 NewRunnableMethod(this, &Launcher::Notify)); 321 NewRunnableMethod(this, &Launcher::Notify));
321 } 322 }
322 } 323 }
323 #endif // !OS_MACOSX 324 #endif // !OS_MACOSX
OLDNEW
« no previous file with comments | « chrome/browser/service/service_process_control.h ('k') | chrome/browser/sessions/restore_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698