| 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.h" | 8 #include "base/message_loop.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // and not show. This seems to happen in single-process mode. | 198 // and not show. This seems to happen in single-process mode. |
| 199 if (host->did_stop_loading()) | 199 if (host->did_stop_loading()) |
| 200 popup->ShowBubble(); | 200 popup->ShowBubble(); |
| 201 | 201 |
| 202 return popup; | 202 return popup; |
| 203 } | 203 } |
| 204 | 204 |
| 205 void ExtensionPopup::ShowBubble() { | 205 void ExtensionPopup::ShowBubble() { |
| 206 Show(); | 206 Show(); |
| 207 | 207 |
| 208 // Request focus for the View. Without this, the FocusManager gets confused. | |
| 209 host()->view()->SetVisible(true); | |
| 210 host()->view()->RequestFocus(); | |
| 211 | |
| 212 // Focus on the host contents when the bubble is first shown. | 208 // Focus on the host contents when the bubble is first shown. |
| 213 host()->host_contents()->Focus(); | 209 host()->host_contents()->Focus(); |
| 214 | 210 |
| 215 // Listen for widget focus changes after showing (used for non-aura win). | 211 // Listen for widget focus changes after showing (used for non-aura win). |
| 216 views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this); | 212 views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this); |
| 217 | 213 |
| 218 if (inspect_with_devtools_) { | 214 if (inspect_with_devtools_) { |
| 219 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), | 215 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), |
| 220 true, | 216 true, |
| 221 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); | 217 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); |
| 222 } | 218 } |
| 223 } | 219 } |
| 224 | 220 |
| 225 void ExtensionPopup::CloseBubble() { | 221 void ExtensionPopup::CloseBubble() { |
| 226 GetWidget()->Close(); | 222 GetWidget()->Close(); |
| 227 } | 223 } |
| OLD | NEW |