| OLD | NEW |
| 1 // Copyright (c) 2011 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/extensions/browser_action_test_util.h" | 5 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" | 11 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" |
| 12 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 12 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
| 13 #include "chrome/browser/ui/gtk/view_id_util.h" | 13 #include "chrome/browser/ui/gtk/view_id_util.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 GtkWidget* GetButton(Browser* browser, int index) { | 17 GtkWidget* GetButton(Browser* browser, int index) { |
| 18 GtkWidget* toolbar = | 18 GtkWidget* toolbar = |
| 19 ViewIDUtil::GetWidget(GTK_WIDGET(browser->window()->GetNativeHandle()), | 19 ViewIDUtil::GetWidget(GTK_WIDGET(browser->window()->GetNativeWindow()), |
| 20 VIEW_ID_BROWSER_ACTION_TOOLBAR); | 20 VIEW_ID_BROWSER_ACTION_TOOLBAR); |
| 21 GtkWidget* button = NULL; | 21 GtkWidget* button = NULL; |
| 22 if (toolbar) { | 22 if (toolbar) { |
| 23 GList* children = gtk_container_get_children(GTK_CONTAINER(toolbar)); | 23 GList* children = gtk_container_get_children(GTK_CONTAINER(toolbar)); |
| 24 GtkWidget* alignment = | 24 GtkWidget* alignment = |
| 25 static_cast<GtkWidget*>(g_list_nth(children, index)->data); | 25 static_cast<GtkWidget*>(g_list_nth(children, index)->data); |
| 26 button = gtk_bin_get_child(GTK_BIN(alignment)); | 26 button = gtk_bin_get_child(GTK_BIN(alignment)); |
| 27 g_list_free(children); | 27 g_list_free(children); |
| 28 } | 28 } |
| 29 return button; | 29 return button; |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 int BrowserActionTestUtil::NumberOfBrowserActions() { | 34 int BrowserActionTestUtil::NumberOfBrowserActions() { |
| 35 int count = -1; | 35 int count = -1; |
| 36 GtkWidget* toolbar = | 36 GtkWidget* toolbar = |
| 37 ViewIDUtil::GetWidget(GTK_WIDGET(browser_->window()->GetNativeHandle()), | 37 ViewIDUtil::GetWidget(GTK_WIDGET(browser_->window()->GetNativeWindow()), |
| 38 VIEW_ID_BROWSER_ACTION_TOOLBAR); | 38 VIEW_ID_BROWSER_ACTION_TOOLBAR); |
| 39 if (toolbar) { | 39 if (toolbar) { |
| 40 GList* children = gtk_container_get_children(GTK_CONTAINER(toolbar)); | 40 GList* children = gtk_container_get_children(GTK_CONTAINER(toolbar)); |
| 41 count = g_list_length(children); | 41 count = g_list_length(children); |
| 42 g_list_free(children); | 42 g_list_free(children); |
| 43 } | 43 } |
| 44 return count; | 44 return count; |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool BrowserActionTestUtil::HasIcon(int index) { | 47 bool BrowserActionTestUtil::HasIcon(int index) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // static | 83 // static |
| 84 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { | 84 gfx::Size BrowserActionTestUtil::GetMinPopupSize() { |
| 85 // On Linux we actually just limit the size of the extension view. | 85 // On Linux we actually just limit the size of the extension view. |
| 86 return gfx::Size(ExtensionPopupGtk::kMinWidth, ExtensionPopupGtk::kMinHeight); | 86 return gfx::Size(ExtensionPopupGtk::kMinWidth, ExtensionPopupGtk::kMinHeight); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // static | 89 // static |
| 90 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { | 90 gfx::Size BrowserActionTestUtil::GetMaxPopupSize() { |
| 91 return gfx::Size(ExtensionPopupGtk::kMaxWidth, ExtensionPopupGtk::kMaxHeight); | 91 return gfx::Size(ExtensionPopupGtk::kMaxWidth, ExtensionPopupGtk::kMaxHeight); |
| 92 } | 92 } |
| OLD | NEW |