| OLD | NEW |
| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 bool pending_create_; | 120 bool pending_create_; |
| 121 base::WeakPtrFactory<ProcessCreationQueue> ptr_factory_; | 121 base::WeakPtrFactory<ProcessCreationQueue> ptr_factory_; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 //////////////// | 124 //////////////// |
| 125 // ExtensionHost | 125 // ExtensionHost |
| 126 | 126 |
| 127 ExtensionHost::ExtensionHost(const extensions::Extension* extension, | 127 ExtensionHost::ExtensionHost(const extensions::Extension* extension, |
| 128 SiteInstance* site_instance, | 128 SiteInstance* site_instance, |
| 129 const GURL& url, | 129 const GURL& url, |
| 130 content::ViewType host_type) | 130 chrome::ViewType host_type) |
| 131 : extension_(extension), | 131 : extension_(extension), |
| 132 extension_id_(extension->id()), | 132 extension_id_(extension->id()), |
| 133 profile_(Profile::FromBrowserContext( | 133 profile_(Profile::FromBrowserContext( |
| 134 site_instance->GetBrowserContext())), | 134 site_instance->GetBrowserContext())), |
| 135 render_view_host_(NULL), | 135 render_view_host_(NULL), |
| 136 did_stop_loading_(false), | 136 did_stop_loading_(false), |
| 137 document_element_available_(false), | 137 document_element_available_(false), |
| 138 initial_url_(url), | 138 initial_url_(url), |
| 139 ALLOW_THIS_IN_INITIALIZER_LIST( | 139 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 140 extension_function_dispatcher_(profile_, this)), | 140 extension_function_dispatcher_(profile_, this)), |
| 141 extension_host_type_(host_type), | 141 extension_host_type_(host_type), |
| 142 associated_web_contents_(NULL) { | 142 associated_web_contents_(NULL) { |
| 143 host_contents_.reset(WebContents::Create( | 143 host_contents_.reset(WebContents::Create( |
| 144 profile_, site_instance, MSG_ROUTING_NONE, NULL, NULL)); | 144 profile_, site_instance, MSG_ROUTING_NONE, NULL, NULL)); |
| 145 content::WebContentsObserver::Observe(host_contents_.get()); | 145 content::WebContentsObserver::Observe(host_contents_.get()); |
| 146 host_contents_->SetDelegate(this); | 146 host_contents_->SetDelegate(this); |
| 147 host_contents_->SetViewType(host_type); | 147 chrome::SetViewType(host_contents_.get(), host_type); |
| 148 | 148 |
| 149 prefs_tab_helper_.reset(new PrefsTabHelper(host_contents())); | 149 prefs_tab_helper_.reset(new PrefsTabHelper(host_contents())); |
| 150 | 150 |
| 151 render_view_host_ = host_contents_->GetRenderViewHost(); | 151 render_view_host_ = host_contents_->GetRenderViewHost(); |
| 152 | 152 |
| 153 // Listen for when an extension is unloaded from the same profile, as it may | 153 // Listen for when an extension is unloaded from the same profile, as it may |
| 154 // be the same extension that this points to. | 154 // be the same extension that this points to. |
| 155 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 155 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 156 content::Source<Profile>(profile_)); | 156 content::Source<Profile>(profile_)); |
| 157 } | 157 } |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 params.user_gesture = user_gesture; | 589 params.user_gesture = user_gesture; |
| 590 browser::Navigate(¶ms); | 590 browser::Navigate(¶ms); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void ExtensionHost::RenderViewReady() { | 593 void ExtensionHost::RenderViewReady() { |
| 594 content::NotificationService::current()->Notify( | 594 content::NotificationService::current()->Notify( |
| 595 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 595 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 596 content::Source<Profile>(profile_), | 596 content::Source<Profile>(profile_), |
| 597 content::Details<ExtensionHost>(this)); | 597 content::Details<ExtensionHost>(this)); |
| 598 } | 598 } |
| OLD | NEW |