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

Side by Side Diff: chrome/browser/extensions/extension_host.cc

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 2 Created 8 years, 7 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
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/extensions/extension_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 typedef std::list<ExtensionHost*> Queue; 115 typedef std::list<ExtensionHost*> Queue;
116 Queue queue_; 116 Queue queue_;
117 bool pending_create_; 117 bool pending_create_;
118 base::WeakPtrFactory<ProcessCreationQueue> ptr_factory_; 118 base::WeakPtrFactory<ProcessCreationQueue> ptr_factory_;
119 }; 119 };
120 120
121 //////////////// 121 ////////////////
122 // ExtensionHost 122 // ExtensionHost
123 123
124 ExtensionHost::ExtensionHost(const Extension* extension, 124 ExtensionHost::ExtensionHost(const extensions::Extension* extension,
125 SiteInstance* site_instance, 125 SiteInstance* site_instance,
126 const GURL& url, 126 const GURL& url,
127 content::ViewType host_type) 127 content::ViewType host_type)
128 : extension_(extension), 128 : extension_(extension),
129 extension_id_(extension->id()), 129 extension_id_(extension->id()),
130 profile_(Profile::FromBrowserContext( 130 profile_(Profile::FromBrowserContext(
131 site_instance->GetBrowserContext())), 131 site_instance->GetBrowserContext())),
132 render_view_host_(NULL), 132 render_view_host_(NULL),
133 did_stop_loading_(false), 133 did_stop_loading_(false),
134 document_element_available_(false), 134 document_element_available_(false),
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 236
237 const GURL& ExtensionHost::GetURL() const { 237 const GURL& ExtensionHost::GetURL() const {
238 return host_contents()->GetURL(); 238 return host_contents()->GetURL();
239 } 239 }
240 240
241 void ExtensionHost::LoadInitialURL() { 241 void ExtensionHost::LoadInitialURL() {
242 if (!is_background_page() && 242 if (!is_background_page() &&
243 !profile_->GetExtensionService()->IsBackgroundPageReady(extension_)) { 243 !profile_->GetExtensionService()->IsBackgroundPageReady(extension_)) {
244 // Make sure the background page loads before any others. 244 // Make sure the background page loads before any others.
245 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY, 245 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
246 content::Source<Extension>(extension_)); 246 content::Source<extensions::Extension>(extension_));
247 return; 247 return;
248 } 248 }
249 249
250 host_contents_->GetController().LoadURL( 250 host_contents_->GetController().LoadURL(
251 initial_url_, content::Referrer(), content::PAGE_TRANSITION_LINK, 251 initial_url_, content::Referrer(), content::PAGE_TRANSITION_LINK,
252 std::string()); 252 std::string());
253 } 253 }
254 254
255 void ExtensionHost::Close() { 255 void ExtensionHost::Close() {
256 content::NotificationService::current()->Notify( 256 content::NotificationService::current()->Notify(
(...skipping 10 matching lines...) Expand all
267 DCHECK(profile_->GetExtensionService()-> 267 DCHECK(profile_->GetExtensionService()->
268 IsBackgroundPageReady(extension_)); 268 IsBackgroundPageReady(extension_));
269 LoadInitialURL(); 269 LoadInitialURL();
270 break; 270 break;
271 case chrome::NOTIFICATION_EXTENSION_UNLOADED: 271 case chrome::NOTIFICATION_EXTENSION_UNLOADED:
272 // The extension object will be deleted after this notification has been 272 // The extension object will be deleted after this notification has been
273 // sent. NULL it out so that dirty pointer issues don't arise in cases 273 // sent. NULL it out so that dirty pointer issues don't arise in cases
274 // when multiple ExtensionHost objects pointing to the same Extension are 274 // when multiple ExtensionHost objects pointing to the same Extension are
275 // present. 275 // present.
276 if (extension_ == 276 if (extension_ ==
277 content::Details<UnloadedExtensionInfo>(details)->extension) { 277 content::Details<extensions::UnloadedExtensionInfo>(
278 details)->extension) {
278 extension_ = NULL; 279 extension_ = NULL;
279 } 280 }
280 break; 281 break;
281 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: 282 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED:
282 if (content::Source<WebContents>(source).ptr() == 283 if (content::Source<WebContents>(source).ptr() ==
283 associated_web_contents_) { 284 associated_web_contents_) {
284 associated_web_contents_ = NULL; 285 associated_web_contents_ = NULL;
285 } 286 }
286 break; 287 break;
287 default: 288 default:
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 params.user_gesture = user_gesture; 586 params.user_gesture = user_gesture;
586 browser::Navigate(&params); 587 browser::Navigate(&params);
587 } 588 }
588 589
589 void ExtensionHost::RenderViewReady() { 590 void ExtensionHost::RenderViewReady() {
590 content::NotificationService::current()->Notify( 591 content::NotificationService::current()->Notify(
591 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, 592 chrome::NOTIFICATION_EXTENSION_HOST_CREATED,
592 content::Source<Profile>(profile_), 593 content::Source<Profile>(profile_),
593 content::Details<ExtensionHost>(this)); 594 content::Details<ExtensionHost>(this));
594 } 595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698