| 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 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/browser/web_contents_view.h" | 25 #include "content/public/browser/web_contents_view.h" |
| 26 #include "ui/gfx/insets.h" | 26 #include "ui/gfx/insets.h" |
| 27 #include "ui/views/layout/fill_layout.h" | 27 #include "ui/views/layout/fill_layout.h" |
| 28 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
| 29 | 29 |
| 30 #if defined(USE_AURA) | 30 #if defined(USE_AURA) |
| 31 #include "ui/aura/client/activation_client.h" | 31 #include "ui/aura/client/activation_client.h" |
| 32 #include "ui/aura/window.h" | 32 #include "ui/aura/window.h" |
| 33 #include "ui/views/corewm/transient_window_manager.h" |
| 33 #include "ui/views/corewm/window_animations.h" | 34 #include "ui/views/corewm/window_animations.h" |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 37 #include "ui/views/win/hwnd_util.h" | 38 #include "ui/views/win/hwnd_util.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 using content::BrowserContext; | 41 using content::BrowserContext; |
| 41 using content::RenderViewHost; | 42 using content::RenderViewHost; |
| 42 using content::WebContents; | 43 using content::WebContents; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // DesktopNativeWidgetAura does not trigger the expected browser widget | 181 // DesktopNativeWidgetAura does not trigger the expected browser widget |
| 181 // [de]activation events when activating widgets in its own root window. | 182 // [de]activation events when activating widgets in its own root window. |
| 182 // This additional check handles those cases. See: http://crbug.com/320889 | 183 // This additional check handles those cases. See: http://crbug.com/320889 |
| 183 aura::Window* this_window = GetWidget()->GetNativeWindow(); | 184 aura::Window* this_window = GetWidget()->GetNativeWindow(); |
| 184 aura::Window* anchor_window = anchor_widget()->GetNativeWindow(); | 185 aura::Window* anchor_window = anchor_widget()->GetNativeWindow(); |
| 185 chrome::HostDesktopType host_desktop_type = | 186 chrome::HostDesktopType host_desktop_type = |
| 186 chrome::GetHostDesktopTypeForNativeWindow(this_window); | 187 chrome::GetHostDesktopTypeForNativeWindow(this_window); |
| 187 if (!inspect_with_devtools_ && anchor_window == gained_active && | 188 if (!inspect_with_devtools_ && anchor_window == gained_active && |
| 188 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH && | 189 host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH && |
| 189 this_window->GetRootWindow() == anchor_window->GetRootWindow() && | 190 this_window->GetRootWindow() == anchor_window->GetRootWindow() && |
| 190 gained_active->transient_parent() != this_window) | 191 views::corewm::GetTransientParent(gained_active) != this_window) |
| 191 GetWidget()->Close(); | 192 GetWidget()->Close(); |
| 192 } | 193 } |
| 193 #endif | 194 #endif |
| 194 | 195 |
| 195 // static | 196 // static |
| 196 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, | 197 ExtensionPopup* ExtensionPopup::ShowPopup(const GURL& url, |
| 197 Browser* browser, | 198 Browser* browser, |
| 198 views::View* anchor_view, | 199 views::View* anchor_view, |
| 199 views::BubbleBorder::Arrow arrow, | 200 views::BubbleBorder::Arrow arrow, |
| 200 ShowAction show_action) { | 201 ShowAction show_action) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 235 |
| 235 // Focus on the host contents when the bubble is first shown. | 236 // Focus on the host contents when the bubble is first shown. |
| 236 host()->host_contents()->GetView()->Focus(); | 237 host()->host_contents()->GetView()->Focus(); |
| 237 | 238 |
| 238 if (inspect_with_devtools_) { | 239 if (inspect_with_devtools_) { |
| 239 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), | 240 DevToolsWindow::ToggleDevToolsWindow(host()->render_view_host(), |
| 240 true, | 241 true, |
| 241 DevToolsToggleAction::ShowConsole()); | 242 DevToolsToggleAction::ShowConsole()); |
| 242 } | 243 } |
| 243 } | 244 } |
| OLD | NEW |