| 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 "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_view_host.h" | 10 #include "chrome/browser/extensions/extension_view_host.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 Browser* browser, | 174 Browser* browser, |
| 175 views::View* anchor_view, | 175 views::View* anchor_view, |
| 176 views::BubbleBorder::Arrow arrow, | 176 views::BubbleBorder::Arrow arrow, |
| 177 ShowAction show_action) { | 177 ShowAction show_action) { |
| 178 extensions::ExtensionViewHost* host = | 178 extensions::ExtensionViewHost* host = |
| 179 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser); | 179 extensions::ExtensionViewHostFactory::CreatePopupHost(url, browser); |
| 180 auto popup = ExtensionPopup::Create(host, anchor_view, arrow, show_action); | 180 auto popup = ExtensionPopup::Create(host, anchor_view, arrow, show_action); |
| 181 | 181 |
| 182 // If the host had somehow finished loading, then we'd miss the notification | 182 // If the host had somehow finished loading, then we'd miss the notification |
| 183 // and not show. This seems to happen in single-process mode. | 183 // and not show. This seems to happen in single-process mode. |
| 184 if (host->did_stop_loading()) | 184 if (host->has_loaded_once()) |
| 185 popup->ShowBubble(); | 185 popup->ShowBubble(); |
| 186 | 186 |
| 187 return popup; | 187 return popup; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ExtensionPopup::ShowBubble() { | 190 void ExtensionPopup::ShowBubble() { |
| 191 GetWidget()->Show(); | 191 GetWidget()->Show(); |
| 192 | 192 |
| 193 // Focus on the host contents when the bubble is first shown. | 193 // Focus on the host contents when the bubble is first shown. |
| 194 host()->host_contents()->Focus(); | 194 host()->host_contents()->Focus(); |
| 195 | 195 |
| 196 if (inspect_with_devtools_) { | 196 if (inspect_with_devtools_) { |
| 197 DevToolsWindow::OpenDevToolsWindow(host()->host_contents(), | 197 DevToolsWindow::OpenDevToolsWindow(host()->host_contents(), |
| 198 DevToolsToggleAction::ShowConsole()); | 198 DevToolsToggleAction::ShowConsole()); |
| 199 } | 199 } |
| 200 } | 200 } |
| OLD | NEW |