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/views/extensions/extension_popup.h" | 5 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_host.h" |
12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_host_factory.h" |
13 #include "chrome/browser/platform_util.h" | 13 #include "chrome/browser/platform_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "content/public/browser/devtools_agent_host.h" | 18 #include "content/public/browser/devtools_agent_host.h" |
19 #include "content/public/browser/devtools_manager.h" | 19 #include "content/public/browser/devtools_manager.h" |
20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
22 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 !IsOwnerOf(activated_view, this_view)) | 160 !IsOwnerOf(activated_view, this_view)) |
161 this_widget->Close(); | 161 this_widget->Close(); |
162 } | 162 } |
163 | 163 |
164 // static | 164 // static |
165 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, | 165 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, |
166 Browser* browser, | 166 Browser* browser, |
167 views::View* anchor_view, | 167 views::View* anchor_view, |
168 views::BubbleBorder::Arrow arrow, | 168 views::BubbleBorder::Arrow arrow, |
169 ShowAction show_action) { | 169 ShowAction show_action) { |
170 ExtensionProcessManager* manager = | 170 extensions::ExtensionHost* host = |
171 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); | 171 extensions::ExtensionHostFactory::CreatePopupHost(url, browser); |
172 extensions::ExtensionHost* host = manager->CreatePopupHost(url, browser); | |
173 ExtensionPopup* popup = new ExtensionPopup(host, anchor_view, arrow, | 172 ExtensionPopup* popup = new ExtensionPopup(host, anchor_view, arrow, |
174 show_action); | 173 show_action); |
175 views::BubbleDelegateView::CreateBubble(popup); | 174 views::BubbleDelegateView::CreateBubble(popup); |
176 | 175 |
177 #if defined(USE_AURA) | 176 #if defined(USE_AURA) |
178 gfx::NativeView native_view = popup->GetWidget()->GetNativeView(); | 177 gfx::NativeView native_view = popup->GetWidget()->GetNativeView(); |
179 views::corewm::SetWindowVisibilityAnimationType( | 178 views::corewm::SetWindowVisibilityAnimationType( |
180 native_view, | 179 native_view, |
181 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); | 180 views::corewm::WINDOW_VISIBILITY_ANIMATION_TYPE_VERTICAL); |
182 views::corewm::SetWindowVisibilityAnimationVerticalPosition( | 181 views::corewm::SetWindowVisibilityAnimationVerticalPosition( |
(...skipping 14 matching lines...) Expand all Loading... |
197 | 196 |
198 // Focus on the host contents when the bubble is first shown. | 197 // Focus on the host contents when the bubble is first shown. |
199 host()->host_contents()->GetView()->Focus(); | 198 host()->host_contents()->GetView()->Focus(); |
200 | 199 |
201 if (inspect_with_devtools_) { | 200 if (inspect_with_devtools_) { |
202 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), | 201 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), |
203 true, | 202 true, |
204 DevToolsToggleAction::ShowConsole()); | 203 DevToolsToggleAction::ShowConsole()); |
205 } | 204 } |
206 } | 205 } |
OLD | NEW |