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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // TODO(benwells): Rearrange so users of this can call | 155 // TODO(benwells): Rearrange so users of this can call |
156 // WebContents::set_should_suppress_dialogs(bool) instead of overriding | 156 // WebContents::set_should_suppress_dialogs(bool) instead of overriding |
157 // this delegate function. | 157 // this delegate function. |
158 bool ShellWindow::ShouldSuppressDialogs() { | 158 bool ShellWindow::ShouldSuppressDialogs() { |
159 return true; | 159 return true; |
160 } | 160 } |
161 | 161 |
162 void ShellWindow::WebIntentDispatch( | 162 void ShellWindow::WebIntentDispatch( |
163 content::WebContents* web_contents, | 163 content::WebContents* web_contents, |
164 content::WebIntentsDispatcher* intents_dispatcher) { | 164 content::WebIntentsDispatcher* intents_dispatcher) { |
165 | |
166 #if defined(ENABLE_WEB_INTENTS) | |
167 if (!web_intents::IsWebIntentsEnabled(profile_)) | 165 if (!web_intents::IsWebIntentsEnabled(profile_)) |
168 return; | 166 return; |
169 | 167 |
170 contents_wrapper_->web_intent_picker_controller()->SetIntentsDispatcher( | 168 contents_wrapper_->web_intent_picker_controller()->SetIntentsDispatcher( |
171 intents_dispatcher); | 169 intents_dispatcher); |
172 contents_wrapper_->web_intent_picker_controller()->ShowDialog( | 170 contents_wrapper_->web_intent_picker_controller()->ShowDialog( |
173 intents_dispatcher->GetIntent().action, | 171 intents_dispatcher->GetIntent().action, |
174 intents_dispatcher->GetIntent().type); | 172 intents_dispatcher->GetIntent().type); |
175 #endif // defined(ENABLE_WEB_INTENTS) | 173 } |
176 } | |
177 | 174 |
178 void ShellWindow::Observe(int type, | 175 void ShellWindow::Observe(int type, |
179 const content::NotificationSource& source, | 176 const content::NotificationSource& source, |
180 const content::NotificationDetails& details) { | 177 const content::NotificationDetails& details) { |
181 switch (type) { | 178 switch (type) { |
182 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { | 179 case chrome::NOTIFICATION_EXTENSION_UNLOADED: { |
183 const Extension* unloaded_extension = | 180 const Extension* unloaded_extension = |
184 content::Details<UnloadedExtensionInfo>(details)->extension; | 181 content::Details<UnloadedExtensionInfo>(details)->extension; |
185 if (extension_ == unloaded_extension) | 182 if (extension_ == unloaded_extension) |
186 Close(); | 183 Close(); |
187 break; | 184 break; |
188 } | 185 } |
189 case content::NOTIFICATION_APP_TERMINATING: | 186 case content::NOTIFICATION_APP_TERMINATING: |
190 Close(); | 187 Close(); |
191 break; | 188 break; |
192 default: | 189 default: |
193 NOTREACHED() << "Received unexpected notification"; | 190 NOTREACHED() << "Received unexpected notification"; |
194 } | 191 } |
195 } | 192 } |
196 | 193 |
197 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 194 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
198 return extension_window_controller_.get(); | 195 return extension_window_controller_.get(); |
199 } | 196 } |
200 | 197 |
201 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 198 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
202 extension_function_dispatcher_.Dispatch(params, | 199 extension_function_dispatcher_.Dispatch(params, |
203 web_contents_->GetRenderViewHost()); | 200 web_contents_->GetRenderViewHost()); |
204 } | 201 } |
OLD | NEW |