| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 14 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 16 #include "content/browser/debugger/devtools_manager.h" | 16 #include "content/browser/debugger/devtools_window.h" |
| 17 #include "content/browser/debugger/devtools_toggle_action.h" | |
| 18 #include "content/browser/renderer_host/render_view_host.h" | 17 #include "content/browser/renderer_host/render_view_host.h" |
| 19 #include "content/browser/renderer_host/render_widget_host_view.h" | 18 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 20 #include "content/common/notification_details.h" | 19 #include "content/common/notification_details.h" |
| 21 #include "content/common/notification_source.h" | 20 #include "content/common/notification_source.h" |
| 22 #include "content/common/notification_type.h" | 21 #include "content/common/notification_type.h" |
| 23 #include "views/widget/root_view.h" | 22 #include "views/widget/root_view.h" |
| 24 #include "views/widget/widget.h" | 23 #include "views/widget/widget.h" |
| 25 | 24 |
| 26 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
| 27 #include "chrome/browser/chromeos/wm_ipc.h" | 26 #include "chrome/browser/chromeos/wm_ipc.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: | 123 case NotificationType::EXTENSION_HOST_DID_STOP_LOADING: |
| 125 // Once we receive did stop loading, the content will be complete and | 124 // Once we receive did stop loading, the content will be complete and |
| 126 // the width will have been computed. Now it's safe to show. | 125 // the width will have been computed. Now it's safe to show. |
| 127 if (extension_host_.get() == Details<ExtensionHost>(details).ptr()) { | 126 if (extension_host_.get() == Details<ExtensionHost>(details).ptr()) { |
| 128 Show(true); | 127 Show(true); |
| 129 | 128 |
| 130 if (inspect_with_devtools_) { | 129 if (inspect_with_devtools_) { |
| 131 // Listen for the the devtools window closing. | 130 // Listen for the the devtools window closing. |
| 132 registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, | 131 registrar_.Add(this, NotificationType::DEVTOOLS_WINDOW_CLOSING, |
| 133 Source<Profile>(extension_host_->profile())); | 132 Source<Profile>(extension_host_->profile())); |
| 134 DevToolsManager::GetInstance()->ToggleDevToolsWindow( | 133 DevToolsWindow::ToggleDevToolsWindow( |
| 135 extension_host_->render_view_host(), | 134 extension_host_->render_view_host(), |
| 136 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); | 135 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); |
| 137 } | 136 } |
| 138 } | 137 } |
| 139 break; | 138 break; |
| 140 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: | 139 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: |
| 141 // If we aren't the host of the popup, then disregard the notification. | 140 // If we aren't the host of the popup, then disregard the notification. |
| 142 if (Details<ExtensionHost>(host()) != details) | 141 if (Details<ExtensionHost>(host()) != details) |
| 143 return; | 142 return; |
| 144 Close(); | 143 Close(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (closing_) | 204 if (closing_) |
| 206 return; | 205 return; |
| 207 closing_ = true; | 206 closing_ = true; |
| 208 DetachFromBrowser(); | 207 DetachFromBrowser(); |
| 209 | 208 |
| 210 if (observer_) | 209 if (observer_) |
| 211 observer_->ExtensionPopupIsClosing(this); | 210 observer_->ExtensionPopupIsClosing(this); |
| 212 | 211 |
| 213 Release(); // Balanced in ctor. | 212 Release(); // Balanced in ctor. |
| 214 } | 213 } |
| OLD | NEW |