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/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
8 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 8 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
9 #include "chrome/browser/extensions/extension_window_controller.h" | 9 #include "chrome/browser/extensions/extension_window_controller.h" |
10 #include "chrome/browser/extensions/shell_window_registry.h" | 10 #include "chrome/browser/extensions/shell_window_registry.h" |
11 #include "chrome/browser/file_select_helper.h" | 11 #include "chrome/browser/file_select_helper.h" |
12 #include "chrome/browser/intents/web_intents_util.h" | 12 #include "chrome/browser/intents/web_intents_util.h" |
13 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sessions/session_id.h" | 15 #include "chrome/browser/sessions/session_id.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 17 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 19 #include "chrome/browser/view_type_utils.h" |
19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/chrome_view_type.h" | |
21 #include "chrome/common/extensions/extension.h" | 21 #include "chrome/common/extensions/extension.h" |
22 #include "chrome/common/extensions/extension_messages.h" | 22 #include "chrome/common/extensions/extension_messages.h" |
23 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
24 #include "content/public/browser/notification_service.h" | 24 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 #include "content/public/browser/notification_types.h" | 26 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
28 #include "content/public/browser/site_instance.h" | 28 #include "content/public/browser/site_instance.h" |
29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
30 #include "content/public/browser/web_intents_dispatcher.h" | 30 #include "content/public/browser/web_intents_dispatcher.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 : profile_(profile), | 104 : profile_(profile), |
105 extension_(extension), | 105 extension_(extension), |
106 ALLOW_THIS_IN_INITIALIZER_LIST( | 106 ALLOW_THIS_IN_INITIALIZER_LIST( |
107 extension_function_dispatcher_(profile, this)) { | 107 extension_function_dispatcher_(profile, this)) { |
108 web_contents_ = WebContents::Create( | 108 web_contents_ = WebContents::Create( |
109 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, | 109 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, |
110 NULL); | 110 NULL); |
111 contents_wrapper_.reset(new TabContentsWrapper(web_contents_)); | 111 contents_wrapper_.reset(new TabContentsWrapper(web_contents_)); |
112 content::WebContentsObserver::Observe(web_contents_); | 112 content::WebContentsObserver::Observe(web_contents_); |
113 web_contents_->SetDelegate(this); | 113 web_contents_->SetDelegate(this); |
114 web_contents_->SetViewType(chrome::VIEW_TYPE_APP_SHELL); | 114 chrome::SetViewType(web_contents_, chrome::VIEW_TYPE_APP_SHELL); |
115 web_contents_->GetMutableRendererPrefs()-> | 115 web_contents_->GetMutableRendererPrefs()-> |
116 browser_handles_all_top_level_requests = true; | 116 browser_handles_all_top_level_requests = true; |
117 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); | 117 web_contents_->GetRenderViewHost()->SyncRendererPrefs(); |
118 | 118 |
119 web_contents_->GetController().LoadURL( | 119 web_contents_->GetController().LoadURL( |
120 url, content::Referrer(), content::PAGE_TRANSITION_LINK, | 120 url, content::Referrer(), content::PAGE_TRANSITION_LINK, |
121 std::string()); | 121 std::string()); |
122 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 122 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
123 content::Source<Profile>(profile_)); | 123 content::Source<Profile>(profile_)); |
124 // Close when the browser is exiting. | 124 // Close when the browser is exiting. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 204 } |
205 | 205 |
206 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 206 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
207 return extension_window_controller_.get(); | 207 return extension_window_controller_.get(); |
208 } | 208 } |
209 | 209 |
210 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 210 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
211 extension_function_dispatcher_.Dispatch(params, | 211 extension_function_dispatcher_.Dispatch(params, |
212 web_contents_->GetRenderViewHost()); | 212 web_contents_->GetRenderViewHost()); |
213 } | 213 } |
OLD | NEW |