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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/debugger/devtools_window.h" | 10 #include "chrome/browser/debugger/devtools_window.h" |
11 #include "chrome/browser/extensions/extension_host.h" | 11 #include "chrome/browser/extensions/extension_host.h" |
12 #include "chrome/browser/extensions/extension_process_manager.h" | 12 #include "chrome/browser/extensions/extension_process_manager.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
18 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
19 #include "content/browser/renderer_host/render_widget_host_view.h" | 19 #include "content/browser/renderer_host/render_widget_host_view.h" |
20 #include "content/browser/tab_contents/tab_contents.h" | |
21 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
22 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.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) && defined(TOOLKIT_USES_GTK) | 25 #if defined(OS_CHROMEOS) && defined(TOOLKIT_USES_GTK) |
27 #include "chrome/browser/chromeos/wm_ipc.h" | 26 #include "chrome/browser/chromeos/wm_ipc.h" |
28 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" | 27 #include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h" |
29 #endif | 28 #endif |
30 | 29 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ResizeToView(); | 88 ResizeToView(); |
90 } | 89 } |
91 | 90 |
92 void ExtensionPopup::BubbleBrowserWindowClosing(BrowserBubble* bubble) { | 91 void ExtensionPopup::BubbleBrowserWindowClosing(BrowserBubble* bubble) { |
93 if (!closing_) | 92 if (!closing_) |
94 Close(); | 93 Close(); |
95 } | 94 } |
96 | 95 |
97 void ExtensionPopup::BubbleGotFocus(BrowserBubble* bubble) { | 96 void ExtensionPopup::BubbleGotFocus(BrowserBubble* bubble) { |
98 // Forward the focus to the renderer. | 97 // Forward the focus to the renderer. |
99 host()->host_contents()->Focus(); | 98 host()->render_view_host()->view()->Focus(); |
100 } | 99 } |
101 | 100 |
102 void ExtensionPopup::BubbleLostFocus(BrowserBubble* bubble, | 101 void ExtensionPopup::BubbleLostFocus(BrowserBubble* bubble, |
103 bool lost_focus_to_child) { | 102 bool lost_focus_to_child) { |
104 if (closing_ || // We are already closing. | 103 if (closing_ || // We are already closing. |
105 inspect_with_devtools_ || // The popup is being inspected. | 104 inspect_with_devtools_ || // The popup is being inspected. |
106 !close_on_lost_focus_ || // Our client is handling focus listening. | 105 !close_on_lost_focus_ || // Our client is handling focus listening. |
107 lost_focus_to_child) // A child of this view got focus. | 106 lost_focus_to_child) // A child of this view got focus. |
108 return; | 107 return; |
109 | 108 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (closing_) | 205 if (closing_) |
207 return; | 206 return; |
208 closing_ = true; | 207 closing_ = true; |
209 DetachFromBrowser(); | 208 DetachFromBrowser(); |
210 | 209 |
211 if (observer_) | 210 if (observer_) |
212 observer_->ExtensionPopupIsClosing(this); | 211 observer_->ExtensionPopupIsClosing(this); |
213 | 212 |
214 Release(); // Balanced in ctor. | 213 Release(); // Balanced in ctor. |
215 } | 214 } |
OLD | NEW |