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

Side by Side Diff: chrome/browser/tab_contents/background_contents.cc

Issue 10968064: Move the NOTIFICATION_APP_TERMINATING notification from content to chrome, since it's fired by chro… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: cros compile Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab_contents/background_contents.h" 5 #include "chrome/browser/tab_contents/background_contents.h"
6 6
7 #include "chrome/browser/background/background_contents_service.h" 7 #include "chrome/browser/background/background_contents_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/renderer_preferences_util.h" 9 #include "chrome/browser/renderer_preferences_util.h"
10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 10 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
(...skipping 19 matching lines...) Expand all
30 30
31 // TODO(rafaelw): Implement correct session storage. 31 // TODO(rafaelw): Implement correct session storage.
32 web_contents_.reset(WebContents::Create( 32 web_contents_.reset(WebContents::Create(
33 profile_, site_instance, routing_id, NULL)); 33 profile_, site_instance, routing_id, NULL));
34 chrome::SetViewType( 34 chrome::SetViewType(
35 web_contents_.get(), chrome::VIEW_TYPE_BACKGROUND_CONTENTS); 35 web_contents_.get(), chrome::VIEW_TYPE_BACKGROUND_CONTENTS);
36 web_contents_->SetDelegate(this); 36 web_contents_->SetDelegate(this);
37 content::WebContentsObserver::Observe(web_contents_.get()); 37 content::WebContentsObserver::Observe(web_contents_.get());
38 38
39 // Close ourselves when the application is shutting down. 39 // Close ourselves when the application is shutting down.
40 registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, 40 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
41 content::NotificationService::AllSources()); 41 content::NotificationService::AllSources());
42 42
43 // Register for our parent profile to shutdown, so we can shut ourselves down 43 // Register for our parent profile to shutdown, so we can shut ourselves down
44 // as well (should only be called for OTR profiles, as we should receive 44 // as well (should only be called for OTR profiles, as we should receive
45 // APP_TERMINATING before non-OTR profiles are destroyed). 45 // APP_TERMINATING before non-OTR profiles are destroyed).
46 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, 46 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
47 content::Source<Profile>(profile_)); 47 content::Source<Profile>(profile_));
48 } 48 }
49 49
50 // Exposed to allow creating mocks. 50 // Exposed to allow creating mocks.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 delete this; 116 delete this;
117 } 117 }
118 118
119 void BackgroundContents::Observe(int type, 119 void BackgroundContents::Observe(int type,
120 const content::NotificationSource& source, 120 const content::NotificationSource& source,
121 const content::NotificationDetails& details) { 121 const content::NotificationDetails& details) {
122 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent 122 // TODO(rafaelw): Implement pagegroup ref-counting so that non-persistent
123 // background pages are closed when the last referencing frame is closed. 123 // background pages are closed when the last referencing frame is closed.
124 switch (type) { 124 switch (type) {
125 case chrome::NOTIFICATION_PROFILE_DESTROYED: 125 case chrome::NOTIFICATION_PROFILE_DESTROYED:
126 case content::NOTIFICATION_APP_TERMINATING: { 126 case chrome::NOTIFICATION_APP_TERMINATING: {
127 delete this; 127 delete this;
128 break; 128 break;
129 } 129 }
130 default: 130 default:
131 NOTREACHED() << "Unexpected notification sent."; 131 NOTREACHED() << "Unexpected notification sent.";
132 break; 132 break;
133 } 133 }
134 } 134 }
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | chrome/browser/ui/cocoa/info_bubble_window.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698