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/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
9 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 9 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
10 #include "chrome/browser/extensions/extension_window_controller.h" | 10 #include "chrome/browser/extensions/extension_window_controller.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 72 } |
73 | 73 |
74 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, | 74 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, |
75 const GURL& extension_url) const { | 75 const GURL& extension_url) const { |
76 // TODO(mihaip): implement | 76 // TODO(mihaip): implement |
77 } | 77 } |
78 | 78 |
79 } // namespace internal | 79 } // namespace internal |
80 | 80 |
81 ShellWindow* ShellWindow::Create(Profile* profile, | 81 ShellWindow* ShellWindow::Create(Profile* profile, |
82 const Extension* extension, | 82 const extensions::Extension* extension, |
83 const GURL& url) { | 83 const GURL& url) { |
84 // This object will delete itself when the window is closed. | 84 // This object will delete itself when the window is closed. |
85 return ShellWindow::CreateImpl(profile, extension, url); | 85 return ShellWindow::CreateImpl(profile, extension, url); |
86 } | 86 } |
87 | 87 |
88 ShellWindow::ShellWindow(Profile* profile, | 88 ShellWindow::ShellWindow(Profile* profile, |
89 const Extension* extension, | 89 const extensions::Extension* extension, |
90 const GURL& url) | 90 const GURL& url) |
91 : profile_(profile), | 91 : profile_(profile), |
92 extension_(extension), | 92 extension_(extension), |
93 ALLOW_THIS_IN_INITIALIZER_LIST( | 93 ALLOW_THIS_IN_INITIALIZER_LIST( |
94 extension_function_dispatcher_(profile, this)) { | 94 extension_function_dispatcher_(profile, this)) { |
95 web_contents_.reset(WebContents::Create( | 95 web_contents_.reset(WebContents::Create( |
96 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, | 96 profile, SiteInstance::CreateForURL(profile, url), MSG_ROUTING_NONE, NULL, |
97 NULL)); | 97 NULL)); |
98 content::WebContentsObserver::Observe(web_contents_.get()); | 98 content::WebContentsObserver::Observe(web_contents_.get()); |
99 web_contents_->SetDelegate(this); | 99 web_contents_->SetDelegate(this); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // this delegate function. | 152 // this delegate function. |
153 bool ShellWindow::ShouldSuppressDialogs() { | 153 bool ShellWindow::ShouldSuppressDialogs() { |
154 return true; | 154 return true; |
155 } | 155 } |
156 | 156 |
157 void ShellWindow::Observe(int type, | 157 void ShellWindow::Observe(int type, |
158 const content::NotificationSource& source, | 158 const content::NotificationSource& source, |
159 const content::NotificationDetails& details) { | 159 const content::NotificationDetails& details) { |
160 switch (type) { | 160 switch (type) { |
161 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 161 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
162 const Extension* unloaded_extension = | 162 const extensions::Extension* unloaded_extension = |
163 content::Details<UnloadedExtensionInfo>(details)->extension; | 163 content::Details<extensions::UnloadedExtensionInfo>( |
| 164 details)->extension; |
164 if (extension_ == unloaded_extension) | 165 if (extension_ == unloaded_extension) |
165 Close(); | 166 Close(); |
166 break; | 167 break; |
167 } | 168 } |
168 case content::NOTIFICATION_APP_TERMINATING: | 169 case content::NOTIFICATION_APP_TERMINATING: |
169 Close(); | 170 Close(); |
170 break; | 171 break; |
171 default: | 172 default: |
172 NOTREACHED() << "Received unexpected notification"; | 173 NOTREACHED() << "Received unexpected notification"; |
173 } | 174 } |
174 } | 175 } |
175 | 176 |
176 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 177 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
177 return extension_window_controller_.get(); | 178 return extension_window_controller_.get(); |
178 } | 179 } |
179 | 180 |
180 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 181 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
181 extension_function_dispatcher_.Dispatch(params, | 182 extension_function_dispatcher_.Dispatch(params, |
182 web_contents_->GetRenderViewHost()); | 183 web_contents_->GetRenderViewHost()); |
183 } | 184 } |
OLD | NEW |