1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_ 6 #define CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_ 7 #pragma once 8 9 #include "chrome/browser/ui/view_ids.h" 10 11 typedef struct _GtkWidget GtkWidget; 12 13 class ViewIDUtil { 14 public: 15 // Use this delegate to override default view id searches. 16 class Delegate { 17 public: 18 virtual GtkWidget* GetWidgetForViewID(ViewID id) = 0; 19 20 protected: ~Delegate()21 virtual ~Delegate() {} 22 }; 23 24 // If you set the ID via this function, it will also set the name of your 25 // widget to a human-readable value for debugging. 26 static void SetID(GtkWidget* widget, ViewID id); 27 28 static GtkWidget* GetWidget(GtkWidget* root, ViewID id); 29 30 static void SetDelegateForWidget(GtkWidget* widget, Delegate* delegate); 31 }; 32 33 #endif // CHROME_BROWSER_UI_GTK_VIEW_ID_UTIL_H_ 34