diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 21:39:16 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 21:39:16 +0000 |
commit | 2f4514d606aa6cb299517998438d4d93122986bd (patch) | |
tree | 2994a227511de4d2136cdfa21c31d5a1be6b7146 /chrome/browser/gtk/view_id_util.cc | |
parent | 142e8a7a1d1de7ba1c601bdff823704f2acbc0fd (diff) | |
download | chromium_src-2f4514d606aa6cb299517998438d4d93122986bd.zip chromium_src-2f4514d606aa6cb299517998438d4d93122986bd.tar.gz chromium_src-2f4514d606aa6cb299517998438d4d93122986bd.tar.bz2 |
GTK: Add a bunch more widget names for parasite.
Also, change slightly how we apply custom styles to certain buttons.
BUG=22096
Review URL: http://codereview.chromium.org/210019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26623 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/view_id_util.cc')
-rw-r--r-- | chrome/browser/gtk/view_id_util.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/chrome/browser/gtk/view_id_util.cc b/chrome/browser/gtk/view_id_util.cc index fe6501f..9a8a875 100644 --- a/chrome/browser/gtk/view_id_util.cc +++ b/chrome/browser/gtk/view_id_util.cc @@ -5,9 +5,12 @@ #include "chrome/browser/gtk/view_id_util.h" #include <stdint.h> +#include <string> #include <gtk/gtk.h> +#include "base/logging.h" + namespace { const char kViewIDString[] = "__VIEW_ID__"; @@ -54,9 +57,66 @@ void SearchForWidgetWithViewID(GtkWidget* widget, gpointer data) { } } +const char* GetNameFromID(ViewID id) { + switch (id) { + case VIEW_ID_TOOLBAR: + return "chrome-toolbar"; + + case VIEW_ID_BACK_BUTTON: + return "chrome-toolbar-back-button"; + + case VIEW_ID_FORWARD_BUTTON: + return "chrome-toolbar-forward-button"; + + case VIEW_ID_RELOAD_BUTTON: + return "chrome-toolbar-reload-button"; + + case VIEW_ID_HOME_BUTTON: + return "chrome-toolbar-home-button"; + + case VIEW_ID_STAR_BUTTON: + return "chrome-toolbar-star-button"; + + case VIEW_ID_LOCATION_BAR: + return "chrome-location-bar"; + + case VIEW_ID_GO_BUTTON: + return "chrome-toolbar-go-button"; + + case VIEW_ID_PAGE_MENU: + return "chrome-page-menu"; + + case VIEW_ID_APP_MENU: + return "chrome-app-menu"; + + case VIEW_ID_AUTOCOMPLETE: + return "chrome-autocomplete-edit"; + + case VIEW_ID_BOOKMARK_MENU: + return "chrome-bookmark-menu"; + + case VIEW_ID_BOOKMARK_BAR: + return "chrome-bookmark-bar"; + + case VIEW_ID_FIND_IN_PAGE_TEXT_FIELD: + return "chrome-find-in-page-entry"; + + // These are never hit because the tab container uses the delegate to + // set its ID. + case VIEW_ID_TAB_CONTAINER: + case VIEW_ID_TAB_CONTAINER_FOCUS_VIEW: + default: + NOTREACHED(); + return NULL; + } +} + } // namespace void ViewIDUtil::SetID(GtkWidget* widget, ViewID id) { + const char* name = GetNameFromID(id); + if (name) + gtk_widget_set_name(widget, name); g_object_set_data(G_OBJECT(widget), kViewIDString, reinterpret_cast<void*>(id)); } |