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" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, | 79 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, |
80 const GURL& extension_url) const { | 80 const GURL& extension_url) const { |
81 // TODO(mihaip): implement | 81 // TODO(mihaip): implement |
82 } | 82 } |
83 | 83 |
84 } // namespace internal | 84 } // namespace internal |
85 | 85 |
86 ShellWindow* ShellWindow::Create(Profile* profile, | 86 ShellWindow* ShellWindow::Create(Profile* profile, |
87 const Extension* extension, | 87 const extensions::Extension* extension, |
88 const GURL& url) { | 88 const GURL& url) { |
89 // This object will delete itself when the window is closed. | 89 // This object will delete itself when the window is closed. |
90 return ShellWindow::CreateImpl(profile, extension, url); | 90 return ShellWindow::CreateImpl(profile, extension, url); |
91 } | 91 } |
92 | 92 |
93 ShellWindow::ShellWindow(Profile* profile, | 93 ShellWindow::ShellWindow(Profile* profile, |
94 const Extension* extension, | 94 const extensions::Extension* extension, |
95 const GURL& url) | 95 const GURL& url) |
96 : profile_(profile), | 96 : profile_(profile), |
97 extension_(extension), | 97 extension_(extension), |
98 ALLOW_THIS_IN_INITIALIZER_LIST( | 98 ALLOW_THIS_IN_INITIALIZER_LIST( |
99 extension_function_dispatcher_(profile, this)) { | 99 extension_function_dispatcher_(profile, this)) { |
100 web_contents_ = WebContents::Create( | 100 web_contents_ = WebContents::Create( |
101 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, | 101 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, |
102 NULL); | 102 NULL); |
103 contents_wrapper_.reset(new TabContentsWrapper(web_contents_)); | 103 contents_wrapper_.reset(new TabContentsWrapper(web_contents_)); |
104 content::WebContentsObserver::Observe(web_contents_); | 104 content::WebContentsObserver::Observe(web_contents_); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void ShellWindow::RunFileChooser(WebContents* tab, | 173 void ShellWindow::RunFileChooser(WebContents* tab, |
174 const content::FileChooserParams& params) { | 174 const content::FileChooserParams& params) { |
175 Browser::RunFileChooserHelper(tab, params); | 175 Browser::RunFileChooserHelper(tab, params); |
176 } | 176 } |
177 | 177 |
178 void ShellWindow::Observe(int type, | 178 void ShellWindow::Observe(int type, |
179 const content::NotificationSource& source, | 179 const content::NotificationSource& source, |
180 const content::NotificationDetails& details) { | 180 const content::NotificationDetails& details) { |
181 switch (type) { | 181 switch (type) { |
182 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 182 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
183 const Extension* unloaded_extension = | 183 const extensions::Extension* unloaded_extension = |
184 content::Details<UnloadedExtensionInfo>(details)->extension; | 184 content::Details<extensions::UnloadedExtensionInfo>( |
| 185 details)->extension; |
185 if (extension_ == unloaded_extension) | 186 if (extension_ == unloaded_extension) |
186 Close(); | 187 Close(); |
187 break; | 188 break; |
188 } | 189 } |
189 case content::NOTIFICATION_APP_TERMINATING: | 190 case content::NOTIFICATION_APP_TERMINATING: |
190 Close(); | 191 Close(); |
191 break; | 192 break; |
192 default: | 193 default: |
193 NOTREACHED() << "Received unexpected notification"; | 194 NOTREACHED() << "Received unexpected notification"; |
194 } | 195 } |
195 } | 196 } |
196 | 197 |
197 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 198 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
198 return extension_window_controller_.get(); | 199 return extension_window_controller_.get(); |
199 } | 200 } |
200 | 201 |
201 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 202 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
202 extension_function_dispatcher_.Dispatch(params, | 203 extension_function_dispatcher_.Dispatch(params, |
203 web_contents_->GetRenderViewHost()); | 204 web_contents_->GetRenderViewHost()); |
204 } | 205 } |
OLD | NEW |