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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/extensions/extension_window_controller.h" | 22 #include "chrome/browser/extensions/extension_window_controller.h" |
23 #include "chrome/browser/file_select_helper.h" | 23 #include "chrome/browser/file_select_helper.h" |
24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 25 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
28 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
29 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
30 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 30 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 31 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 32 #include "chrome/browser/view_type_utils.h" |
32 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
33 #include "chrome/common/chrome_notification_types.h" | 34 #include "chrome/common/chrome_notification_types.h" |
34 #include "chrome/common/chrome_view_type.h" | |
35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
36 #include "chrome/common/extensions/extension_constants.h" | 36 #include "chrome/common/extensions/extension_constants.h" |
37 #include "chrome/common/extensions/extension_messages.h" | 37 #include "chrome/common/extensions/extension_messages.h" |
38 #include "chrome/common/render_messages.h" | 38 #include "chrome/common/render_messages.h" |
39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
40 #include "content/public/browser/content_browser_client.h" | 40 #include "content/public/browser/content_browser_client.h" |
41 #include "content/public/browser/native_web_keyboard_event.h" | 41 #include "content/public/browser/native_web_keyboard_event.h" |
42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
43 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
44 #include "content/public/browser/render_view_host.h" | 44 #include "content/public/browser/render_view_host.h" |
(...skipping 75 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 |