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/view_id_util.h" | 5 #include "chrome/browser/ui/gtk/view_id_util.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 case VIEW_ID_FIND_IN_PAGE_TEXT_FIELD: | 104 case VIEW_ID_FIND_IN_PAGE_TEXT_FIELD: |
105 return "chrome-find-in-page-entry"; | 105 return "chrome-find-in-page-entry"; |
106 | 106 |
107 case VIEW_ID_FIND_IN_PAGE: | 107 case VIEW_ID_FIND_IN_PAGE: |
108 return "chrome-find-in-page"; | 108 return "chrome-find-in-page"; |
109 | 109 |
110 case VIEW_ID_DEV_TOOLS_DOCKED: | 110 case VIEW_ID_DEV_TOOLS_DOCKED: |
111 return "chrome-dev-tools-docked"; | 111 return "chrome-dev-tools-docked"; |
112 | 112 |
| 113 case VIEW_ID_ZOOM_BUTTON: |
| 114 return "chrome-zoom-button"; |
| 115 |
113 // These are never hit because the tab container uses the delegate to | 116 // These are never hit because the tab container uses the delegate to |
114 // set its ID. | 117 // set its ID. |
115 case VIEW_ID_TAB_CONTAINER: | 118 case VIEW_ID_TAB_CONTAINER: |
116 default: | 119 default: |
117 NOTREACHED() << "If you added a new VIEW_ID, please provide " | 120 NOTREACHED() << "If you added a new VIEW_ID, please provide " |
118 "a name for the widget."; | 121 "a name for the widget."; |
119 return NULL; | 122 return NULL; |
120 } | 123 } |
121 } | 124 } |
122 | 125 |
123 } // namespace | 126 } // namespace |
124 | 127 |
125 void ViewIDUtil::SetID(GtkWidget* widget, ViewID id) { | 128 void ViewIDUtil::SetID(GtkWidget* widget, ViewID id) { |
126 const char* name = GetNameFromID(id); | 129 const char* name = GetNameFromID(id); |
127 if (name) | 130 if (name) |
128 gtk_widget_set_name(widget, name); | 131 gtk_widget_set_name(widget, name); |
129 g_object_set_data(G_OBJECT(widget), kViewIDString, | 132 g_object_set_data(G_OBJECT(widget), kViewIDString, |
130 reinterpret_cast<void*>(id)); | 133 reinterpret_cast<void*>(id)); |
131 } | 134 } |
132 | 135 |
133 GtkWidget* ViewIDUtil::GetWidget(GtkWidget* root, ViewID id) { | 136 GtkWidget* ViewIDUtil::GetWidget(GtkWidget* root, ViewID id) { |
134 ViewIDSearchStruct search_struct = { id, NULL }; | 137 ViewIDSearchStruct search_struct = { id, NULL }; |
135 SearchForWidgetWithViewID(root, &search_struct); | 138 SearchForWidgetWithViewID(root, &search_struct); |
136 return search_struct.widget; | 139 return search_struct.widget; |
137 } | 140 } |
138 | 141 |
139 void ViewIDUtil::SetDelegateForWidget(GtkWidget* widget, Delegate* delegate) { | 142 void ViewIDUtil::SetDelegateForWidget(GtkWidget* widget, Delegate* delegate) { |
140 g_object_set_data(G_OBJECT(widget), kViewIDOverrideString, delegate); | 143 g_object_set_data(G_OBJECT(widget), kViewIDOverrideString, delegate); |
141 } | 144 } |
OLD | NEW |