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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/debugger/devtools_window.h" | 9 #include "chrome/browser/debugger/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 const int ExtensionPopup::kMinHeight = 25; | 26 const int ExtensionPopup::kMinHeight = 25; |
27 const int ExtensionPopup::kMaxWidth = 800; | 27 const int ExtensionPopup::kMaxWidth = 800; |
28 const int ExtensionPopup::kMaxHeight = 600; | 28 const int ExtensionPopup::kMaxHeight = 600; |
29 | 29 |
30 ExtensionPopup::ExtensionPopup( | 30 ExtensionPopup::ExtensionPopup( |
31 Browser* browser, | 31 Browser* browser, |
32 ExtensionHost* host, | 32 ExtensionHost* host, |
33 views::View* anchor_view, | 33 views::View* anchor_view, |
34 views::BubbleBorder::ArrowLocation arrow_location, | 34 views::BubbleBorder::ArrowLocation arrow_location, |
35 bool inspect_with_devtools) | 35 bool inspect_with_devtools) |
36 : BubbleDelegateView(anchor_view, arrow_location, SK_ColorWHITE), | 36 : BubbleDelegateView(anchor_view, arrow_location), |
37 extension_host_(host), | 37 extension_host_(host), |
38 inspect_with_devtools_(inspect_with_devtools) { | 38 inspect_with_devtools_(inspect_with_devtools) { |
39 SetLayoutManager(new views::FillLayout()); | 39 SetLayoutManager(new views::FillLayout()); |
40 AddChildView(host->view()); | 40 AddChildView(host->view()); |
41 host->view()->SetContainer(this); | 41 host->view()->SetContainer(this); |
42 set_close_on_deactivate(!inspect_with_devtools); | 42 set_close_on_deactivate(!inspect_with_devtools); |
43 | 43 |
44 // We wait to show the popup until the contained host finishes loading. | 44 // We wait to show the popup until the contained host finishes loading. |
45 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 45 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
46 content::Source<Profile>(host->profile())); | 46 content::Source<Profile>(host->profile())); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // If the host had somehow finished loading, then we'd miss the notification | 123 // If the host had somehow finished loading, then we'd miss the notification |
124 // and not show. This seems to happen in single-process mode. | 124 // and not show. This seems to happen in single-process mode. |
125 if (host->did_stop_loading()) { | 125 if (host->did_stop_loading()) { |
126 popup->Show(); | 126 popup->Show(); |
127 // Focus on the host contents when the bubble is first shown. | 127 // Focus on the host contents when the bubble is first shown. |
128 host->host_contents()->Focus(); | 128 host->host_contents()->Focus(); |
129 } | 129 } |
130 | 130 |
131 return popup; | 131 return popup; |
132 } | 132 } |
OLD | NEW |