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 "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/browser/extensions/extension_view_host.h" | 10 #include "chrome/browser/extensions/extension_view_host.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return; | 137 return; |
138 // Widget::Close posts a task, which should give the devtools window a | 138 // Widget::Close posts a task, which should give the devtools window a |
139 // chance to finish detaching from the inspected RenderViewHost. | 139 // chance to finish detaching from the inspected RenderViewHost. |
140 GetWidget()->Close(); | 140 GetWidget()->Close(); |
141 } | 141 } |
142 | 142 |
143 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { | 143 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { |
144 SizeToContents(); | 144 SizeToContents(); |
145 } | 145 } |
146 | 146 |
147 gfx::Size ExtensionPopup::GetPreferredSize() const { | 147 gfx::Size ExtensionPopup::GetUnsnappedPreferredSize() const { |
148 // Constrain the size to popup min/max. | 148 // Constrain the size to popup min/max. |
149 gfx::Size sz = views::View::GetPreferredSize(); | 149 gfx::Size sz = views::View::GetPreferredSize(); |
150 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); | 150 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); |
151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); | 151 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); |
152 return sz; | 152 return sz; |
153 } | 153 } |
154 | 154 |
155 void ExtensionPopup::ViewHierarchyChanged( | 155 void ExtensionPopup::ViewHierarchyChanged( |
156 const ViewHierarchyChangedDetails& details) { | 156 const ViewHierarchyChangedDetails& details) { |
157 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776 | 157 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 GetWidget()->Show(); | 197 GetWidget()->Show(); |
198 | 198 |
199 // Focus on the host contents when the bubble is first shown. | 199 // Focus on the host contents when the bubble is first shown. |
200 host()->host_contents()->Focus(); | 200 host()->host_contents()->Focus(); |
201 | 201 |
202 if (inspect_with_devtools_) { | 202 if (inspect_with_devtools_) { |
203 DevToolsWindow::OpenDevToolsWindow( | 203 DevToolsWindow::OpenDevToolsWindow( |
204 host()->host_contents(), DevToolsToggleAction::ShowConsolePanel()); | 204 host()->host_contents(), DevToolsToggleAction::ShowConsolePanel()); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |