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" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "content/public/browser/web_contents_view.h" | 26 #include "content/public/browser/web_contents_view.h" |
27 #include "ui/gfx/insets.h" | 27 #include "ui/gfx/insets.h" |
28 #include "ui/views/layout/fill_layout.h" | 28 #include "ui/views/layout/fill_layout.h" |
29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
30 | 30 |
31 #if defined(USE_AURA) | 31 #if defined(USE_AURA) |
32 #include "ui/aura/client/activation_client.h" | 32 #include "ui/aura/client/activation_client.h" |
33 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
34 #include "ui/views/corewm/window_animations.h" | 34 #include "ui/views/corewm/window_animations.h" |
| 35 #include "ui/views/corewm/window_util.h" |
35 #endif | 36 #endif |
36 | 37 |
37 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
38 #include "ui/views/win/hwnd_util.h" | 39 #include "ui/views/win/hwnd_util.h" |
39 #endif | 40 #endif |
40 | 41 |
41 using content::BrowserContext; | 42 using content::BrowserContext; |
42 using content::RenderViewHost; | 43 using content::RenderViewHost; |
43 using content::WebContents; | 44 using content::WebContents; |
44 | 45 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // DesktopNativeWidgetAura does not trigger the expected browser widget | 191 // DesktopNativeWidgetAura does not trigger the expected browser widget |
191 // [de]activation events when activating widgets in its own root window. | 192 // [de]activation events when activating widgets in its own root window. |
192 // This additional check handles those cases. See: http://crbug.com/320889 | 193 // This additional check handles those cases. See: http://crbug.com/320889 |
193 aura::Window* this_window = GetWidget()->GetNativeWindow(); | 194 aura::Window* this_window = GetWidget()->GetNativeWindow(); |
194 aura::Window* anchor_window = anchor_widget()->GetNativeWindow(); | 195 aura::Window* anchor_window = anchor_widget()->GetNativeWindow(); |
195 chrome::HostDesktopType host_desktop_type = | 196 chrome::HostDesktopType host_desktop_type = |
196 chrome::GetHostDesktopTypeForNativeWindow(this_window); | 197 chrome::GetHostDesktopTypeForNativeWindow(this_window); |
197 if (!inspect_with_devtools_ && anchor_window == gained_active && | 198 if (!inspect_with_devtools_ && anchor_window == gained_active && |
198 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH && | 199 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH && |
199 this_window->GetRootWindow() == anchor_window->GetRootWindow() && | 200 this_window->GetRootWindow() == anchor_window->GetRootWindow() && |
200 gained_active->transient_parent() != this_window) | 201 views::corewm::GetTransientParent(gained_active) != this_window) |
201 GetWidget()->Close(); | 202 GetWidget()->Close(); |
202 } | 203 } |
203 #endif | 204 #endif |
204 | 205 |
205 void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents, | 206 void ExtensionPopup::ActiveTabChanged(content::WebContents* old_contents, |
206 content::WebContents* new_contents, | 207 content::WebContents* new_contents, |
207 int index, | 208 int index, |
208 int reason) { | 209 int reason) { |
209 GetWidget()->Close(); | 210 GetWidget()->Close(); |
210 } | 211 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 252 |
252 // Focus on the host contents when the bubble is first shown. | 253 // Focus on the host contents when the bubble is first shown. |
253 host()->host_contents()->GetView()->Focus(); | 254 host()->host_contents()->GetView()->Focus(); |
254 | 255 |
255 if (inspect_with_devtools_) { | 256 if (inspect_with_devtools_) { |
256 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), | 257 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), |
257 true, | 258 true, |
258 DevToolsToggleAction::ShowConsole()); | 259 DevToolsToggleAction::ShowConsole()); |
259 } | 260 } |
260 } | 261 } |
OLD | NEW |