| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Widget::Close posts a task, which should give the devtools window a | 111 // Widget::Close posts a task, which should give the devtools window a |
| 112 // chance to finish detaching from the inspected RenderViewHost. | 112 // chance to finish detaching from the inspected RenderViewHost. |
| 113 GetWidget()->Close(); | 113 GetWidget()->Close(); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { | 117 void ExtensionPopup::OnExtensionSizeChanged(ExtensionViewViews* view) { |
| 118 SizeToContents(); | 118 SizeToContents(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 gfx::Size ExtensionPopup::GetPreferredSize() { | 121 gfx::Size ExtensionPopup::GetPreferredSize() const { |
| 122 // Constrain the size to popup min/max. | 122 // Constrain the size to popup min/max. |
| 123 gfx::Size sz = views::View::GetPreferredSize(); | 123 gfx::Size sz = views::View::GetPreferredSize(); |
| 124 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); | 124 sz.set_width(std::max(kMinWidth, std::min(kMaxWidth, sz.width()))); |
| 125 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); | 125 sz.set_height(std::max(kMinHeight, std::min(kMaxHeight, sz.height()))); |
| 126 return sz; | 126 return sz; |
| 127 } | 127 } |
| 128 | 128 |
| 129 void ExtensionPopup::ViewHierarchyChanged( | 129 void ExtensionPopup::ViewHierarchyChanged( |
| 130 const ViewHierarchyChangedDetails& details) { | 130 const ViewHierarchyChangedDetails& details) { |
| 131 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776 | 131 // TODO(msw): Find any remaining crashes related to http://crbug.com/327776 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 GetWidget()->Show(); | 215 GetWidget()->Show(); |
| 216 | 216 |
| 217 // Focus on the host contents when the bubble is first shown. | 217 // Focus on the host contents when the bubble is first shown. |
| 218 host()->host_contents()->Focus(); | 218 host()->host_contents()->Focus(); |
| 219 | 219 |
| 220 if (inspect_with_devtools_) { | 220 if (inspect_with_devtools_) { |
| 221 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), | 221 DevToolsWindow::OpenDevToolsWindow(host()->render_view_host(), |
| 222 DevToolsToggleAction::ShowConsole()); | 222 DevToolsToggleAction::ShowConsole()); |
| 223 } | 223 } |
| 224 } | 224 } |
| OLD | NEW |