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/gtk/extensions/extension_popup_gtk.h" | 5 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 NOTREACHED() << "Received unexpected notification"; | 129 NOTREACHED() << "Received unexpected notification"; |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 void ExtensionPopupGtk::BubbleClosing(BubbleGtk* bubble, | 133 void ExtensionPopupGtk::BubbleClosing(BubbleGtk* bubble, |
134 bool closed_by_escape) { | 134 bool closed_by_escape) { |
135 current_extension_popup_ = NULL; | 135 current_extension_popup_ = NULL; |
136 delete this; | 136 delete this; |
137 } | 137 } |
138 | 138 |
139 void ExtensionPopupGtk::OnExtensionPreferredSizeChanged( | 139 void ExtensionPopupGtk::OnExtensionSizeChanged( |
140 ExtensionViewGtk* view, | 140 ExtensionViewGtk* view, |
141 const gfx::Size& new_size) { | 141 const gfx::Size& new_size) { |
142 int width = std::max(kMinWidth, std::min(kMaxWidth, new_size.width())); | 142 int width = std::max(kMinWidth, std::min(kMaxWidth, new_size.width())); |
143 int height = std::max(kMinHeight, std::min(kMaxHeight, new_size.height())); | 143 int height = std::max(kMinHeight, std::min(kMaxHeight, new_size.height())); |
144 | 144 |
145 view->render_view_host()->GetView()->SetSize(gfx::Size(width, height)); | 145 view->render_view_host()->GetView()->SetSize(gfx::Size(width, height)); |
146 gtk_widget_set_size_request(view->native_view(), width, height); | 146 gtk_widget_set_size_request(view->native_view(), width, height); |
147 } | 147 } |
148 | 148 |
149 bool ExtensionPopupGtk::DestroyPopup() { | 149 bool ExtensionPopupGtk::DestroyPopup() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 void ExtensionPopupGtk::DestroyPopupWithoutResult() { | 193 void ExtensionPopupGtk::DestroyPopupWithoutResult() { |
194 DestroyPopup(); | 194 DestroyPopup(); |
195 } | 195 } |
196 | 196 |
197 gfx::Rect ExtensionPopupGtk::GetViewBounds() { | 197 gfx::Rect ExtensionPopupGtk::GetViewBounds() { |
198 GtkAllocation allocation; | 198 GtkAllocation allocation; |
199 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); | 199 gtk_widget_get_allocation(host_->view()->native_view(), &allocation); |
200 return gfx::Rect(allocation); | 200 return gfx::Rect(allocation); |
201 } | 201 } |
OLD | NEW |