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

Side by Side Diff: chrome/browser/background/background_contents_service.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/background/background_contents_service.h" 5 #include "chrome/browser/background/background_contents_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
24 #include "chrome/common/chrome_notification_types.h" 24 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
26 #include "chrome/common/extensions/extension.h" 26 #include "chrome/common/extensions/extension.h"
27 #include "chrome/common/extensions/extension_constants.h" 27 #include "chrome/common/extensions/extension_constants.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "content/browser/renderer_host/render_view_host.h" 29 #include "content/browser/renderer_host/render_view_host.h"
30 #include "content/browser/site_instance.h" 30 #include "content/browser/site_instance.h"
31 #include "content/browser/tab_contents/tab_contents.h" 31 #include "content/browser/tab_contents/tab_contents.h"
32 #include "content/common/notification_service.h" 32 #include "content/public/browser/notification_service.h"
33 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "ui/base/l10n/l10n_util.h" 34 #include "ui/base/l10n/l10n_util.h"
35 35
36 namespace { 36 namespace {
37 37
38 const char kNotificationPrefix[] = "app.background.crashed."; 38 const char kNotificationPrefix[] = "app.background.crashed.";
39 39
40 void CloseBalloon(const std::string id) { 40 void CloseBalloon(const std::string id) {
41 g_browser_process->notification_ui_manager()->CancelById(id); 41 g_browser_process->notification_ui_manager()->CancelById(id);
42 } 42 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 const string16& frame_name, 468 const string16& frame_name,
469 const string16& application_id) { 469 const string16& application_id) {
470 BackgroundContents* contents = new BackgroundContents(site, routing_id, this); 470 BackgroundContents* contents = new BackgroundContents(site, routing_id, this);
471 471
472 // Register the BackgroundContents internally, then send out a notification 472 // Register the BackgroundContents internally, then send out a notification
473 // to external listeners. 473 // to external listeners.
474 BackgroundContentsOpenedDetails details = {contents, 474 BackgroundContentsOpenedDetails details = {contents,
475 frame_name, 475 frame_name,
476 application_id}; 476 application_id};
477 BackgroundContentsOpened(&details); 477 BackgroundContentsOpened(&details);
478 NotificationService::current()->Notify( 478 content::NotificationService::current()->Notify(
479 chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED, 479 chrome::NOTIFICATION_BACKGROUND_CONTENTS_OPENED,
480 content::Source<Profile>(profile), 480 content::Source<Profile>(profile),
481 content::Details<BackgroundContentsOpenedDetails>(&details)); 481 content::Details<BackgroundContentsOpenedDetails>(&details));
482 return contents; 482 return contents;
483 } 483 }
484 484
485 void BackgroundContentsService::RegisterBackgroundContents( 485 void BackgroundContentsService::RegisterBackgroundContents(
486 BackgroundContents* background_contents) { 486 BackgroundContents* background_contents) {
487 DCHECK(IsTracked(background_contents)); 487 DCHECK(IsTracked(background_contents));
488 if (!prefs_) 488 if (!prefs_)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 TabContents* new_contents, 574 TabContents* new_contents,
575 WindowOpenDisposition disposition, 575 WindowOpenDisposition disposition,
576 const gfx::Rect& initial_pos, 576 const gfx::Rect& initial_pos,
577 bool user_gesture) { 577 bool user_gesture) {
578 Browser* browser = BrowserList::GetLastActiveWithProfile( 578 Browser* browser = BrowserList::GetLastActiveWithProfile(
579 Profile::FromBrowserContext(new_contents->browser_context())); 579 Profile::FromBrowserContext(new_contents->browser_context()));
580 if (!browser) 580 if (!browser)
581 return; 581 return;
582 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture); 582 browser->AddTabContents(new_contents, disposition, initial_pos, user_gesture);
583 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698