OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/extensions/extension_popup.h" | 5 #include "chrome/browser/views/extensions/extension_popup.h" |
6 | 6 |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/browser_window.h" | 8 #include "chrome/browser/browser_window.h" |
9 #include "chrome/browser/profile.h" | 9 #include "chrome/browser/profile.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
11 #include "chrome/browser/views/frame/browser_view.h" | 11 #include "chrome/browser/views/frame/browser_view.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/common/notification_details.h" | 13 #include "chrome/common/notification_details.h" |
14 #include "chrome/common/notification_source.h" | 14 #include "chrome/common/notification_source.h" |
15 #include "chrome/common/notification_type.h" | 15 #include "chrome/common/notification_type.h" |
16 | 16 |
17 #include "views/widget/root_view.h" | 17 #include "views/widget/root_view.h" |
18 | 18 |
| 19 using views::Widget; |
| 20 |
19 ExtensionPopup::ExtensionPopup(ExtensionHost* host, | 21 ExtensionPopup::ExtensionPopup(ExtensionHost* host, |
20 views::Widget* frame, | 22 Widget* frame, |
21 const gfx::Rect& relative_to) | 23 const gfx::Rect& relative_to) |
22 : BrowserBubble(host->view(), frame, gfx::Point()), | 24 : BrowserBubble(host->view(), frame, gfx::Point()), |
23 relative_to_(relative_to), | 25 relative_to_(relative_to), |
24 extension_host_(host) { | 26 extension_host_(host) { |
25 host->view()->SetContainer(this); | 27 host->view()->SetContainer(this); |
26 registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, | 28 registrar_.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, |
27 Source<Profile>(host->profile())); | 29 Source<Profile>(host->profile())); |
28 | 30 |
29 // TODO(erikkay) Some of this border code is derived from InfoBubble. | 31 // TODO(erikkay) Some of this border code is derived from InfoBubble. |
30 // We should see if we can unify these classes. | 32 // We should see if we can unify these classes. |
31 | 33 |
32 // |true| here means the widget is set to delete on destroy. | 34 // |true| here means the widget is set to delete on destroy. |
33 border_widget_ = views::Widget::CreateTransparentPopupWidget(true); | 35 border_widget_ = Widget::CreatePopupWidget(Widget::Transparent, |
| 36 Widget::NotAcceptEvents, |
| 37 Widget::DeleteOnDestroy); |
34 gfx::NativeView native_window = frame->GetNativeView(); | 38 gfx::NativeView native_window = frame->GetNativeView(); |
35 border_widget_->Init(native_window, bounds()); | 39 border_widget_->Init(native_window, bounds()); |
36 border_ = new BubbleBorder; | 40 border_ = new BubbleBorder; |
37 border_->set_arrow_location(BubbleBorder::TOP_RIGHT); | 41 border_->set_arrow_location(BubbleBorder::TOP_RIGHT); |
38 border_view_ = new views::View; | 42 border_view_ = new views::View; |
39 border_view_->set_background(new BubbleBackground(border_)); | 43 border_view_->set_background(new BubbleBackground(border_)); |
40 border_view_->set_border(border_); | 44 border_view_->set_border(border_); |
41 border_widget_->SetContentsView(border_view_); | 45 border_widget_->SetContentsView(border_view_); |
42 } | 46 } |
43 | 47 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 browser->window()->GetNativeHandle())->GetWidget(); | 123 browser->window()->GetNativeHandle())->GetWidget(); |
120 ExtensionPopup* popup = new ExtensionPopup(host, frame, relative_to); | 124 ExtensionPopup* popup = new ExtensionPopup(host, frame, relative_to); |
121 | 125 |
122 // If the host had somehow finished loading, then we'd miss the notification | 126 // If the host had somehow finished loading, then we'd miss the notification |
123 // and not show. This seems to happen in single-process mode. | 127 // and not show. This seems to happen in single-process mode. |
124 if (host->did_stop_loading()) | 128 if (host->did_stop_loading()) |
125 popup->Show(); | 129 popup->Show(); |
126 | 130 |
127 return popup; | 131 return popup; |
128 } | 132 } |
OLD | NEW |