| 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 #include "views/widget/root_view.h" | 16 #include "views/widget/root_view.h" |
| 17 #include "views/window/window.h" |
| 17 | 18 |
| 18 using views::Widget; | 19 using views::Widget; |
| 19 | 20 |
| 20 // The minimum/maximum dimensions of the popup. | 21 // The minimum/maximum dimensions of the popup. |
| 21 // The minimum is just a little larger than the size of the button itself. | 22 // The minimum is just a little larger than the size of the button itself. |
| 22 // The maximum is an arbitrary number that should be smaller than most screens. | 23 // The maximum is an arbitrary number that should be smaller than most screens. |
| 23 const int ExtensionPopup::kMinWidth = 25; | 24 const int ExtensionPopup::kMinWidth = 25; |
| 24 const int ExtensionPopup::kMinHeight = 25; | 25 const int ExtensionPopup::kMinHeight = 25; |
| 25 const int ExtensionPopup::kMaxWidth = 800; | 26 const int ExtensionPopup::kMaxWidth = 800; |
| 26 const int ExtensionPopup::kMaxHeight = 600; | 27 const int ExtensionPopup::kMaxHeight = 600; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 59 |
| 59 void ExtensionPopup::Hide() { | 60 void ExtensionPopup::Hide() { |
| 60 BrowserBubble::Hide(); | 61 BrowserBubble::Hide(); |
| 61 border_widget_->Hide(); | 62 border_widget_->Hide(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void ExtensionPopup::Show() { | 65 void ExtensionPopup::Show() { |
| 65 if (visible()) | 66 if (visible()) |
| 66 return; | 67 return; |
| 67 | 68 |
| 69 #if defined(OS_WIN) |
| 70 frame_->GetWindow()->DisableInactiveRendering(); |
| 71 #endif |
| 72 |
| 68 ResizeToView(); | 73 ResizeToView(); |
| 69 | 74 |
| 70 // Show the border first, then the popup overlaid on top. | 75 // Show the border first, then the popup overlaid on top. |
| 71 border_widget_->Show(); | 76 border_widget_->Show(); |
| 72 BrowserBubble::Show(true); | 77 BrowserBubble::Show(true); |
| 73 } | 78 } |
| 74 | 79 |
| 75 void ExtensionPopup::ResizeToView() { | 80 void ExtensionPopup::ResizeToView() { |
| 76 // We'll be sizing ourselves to this size shortly, but wait until we | 81 // We'll be sizing ourselves to this size shortly, but wait until we |
| 77 // know our position to do it. | 82 // know our position to do it. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 browser->window()->GetNativeHandle())->GetWidget(); | 142 browser->window()->GetNativeHandle())->GetWidget(); |
| 138 ExtensionPopup* popup = new ExtensionPopup(host, frame, relative_to); | 143 ExtensionPopup* popup = new ExtensionPopup(host, frame, relative_to); |
| 139 | 144 |
| 140 // If the host had somehow finished loading, then we'd miss the notification | 145 // If the host had somehow finished loading, then we'd miss the notification |
| 141 // and not show. This seems to happen in single-process mode. | 146 // and not show. This seems to happen in single-process mode. |
| 142 if (host->did_stop_loading()) | 147 if (host->did_stop_loading()) |
| 143 popup->Show(); | 148 popup->Show(); |
| 144 | 149 |
| 145 return popup; | 150 return popup; |
| 146 } | 151 } |
| OLD | NEW |