| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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_GTK_KEYWORD_EDITOR_VIEW_H_ |
| 6 #define CHROME_BROWSER_GTK_KEYWORD_EDITOR_VIEW_H_ |
| 7 |
| 8 #include <gtk/gtk.h> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "chrome/browser/search_engines/edit_keyword_controller_base.h" |
| 12 #include "chrome/browser/search_engines/template_url_model.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 class KeywordEditorView : public TemplateURLModelObserver, |
| 17 public EditKeywordControllerBase::Delegate { |
| 18 public: |
| 19 virtual ~KeywordEditorView(); |
| 20 |
| 21 // Create (if necessary) and show the keyword editor window. |
| 22 static void Show(Profile* profile); |
| 23 |
| 24 // Overriden from EditKeywordControllerBase::Delegate. |
| 25 virtual void OnEditedKeyword(const TemplateURL* template_url, |
| 26 const std::wstring& title, |
| 27 const std::wstring& keyword, |
| 28 const std::wstring& url); |
| 29 private: |
| 30 explicit KeywordEditorView(Profile* profile); |
| 31 void Init(); |
| 32 |
| 33 // Enable buttons based on selection state. |
| 34 void EnableControls(); |
| 35 |
| 36 // TemplateURLModelObserver notification. |
| 37 virtual void OnTemplateURLModelChanged(); |
| 38 |
| 39 // Callback for window destruction. |
| 40 static void OnWindowDestroy(GtkWidget* widget, KeywordEditorView* window); |
| 41 |
| 42 // Callback for dialog buttons. |
| 43 static void OnResponse(GtkDialog* dialog, int response_id, |
| 44 KeywordEditorView* window); |
| 45 |
| 46 // Callback for when user selects something. |
| 47 static void OnSelectionChanged(GtkTreeSelection *selection, |
| 48 KeywordEditorView* editor); |
| 49 |
| 50 // Callbacks for buttons modifying the table. |
| 51 static void OnAddButtonClicked(GtkButton* button, |
| 52 KeywordEditorView* editor); |
| 53 static void OnEditButtonClicked(GtkButton* button, |
| 54 KeywordEditorView* editor); |
| 55 static void OnRemoveButtonClicked(GtkButton* button, |
| 56 KeywordEditorView* editor); |
| 57 static void OnMakeDefaultButtonClicked(GtkButton* button, |
| 58 KeywordEditorView* editor); |
| 59 |
| 60 // The table listing the search engines. |
| 61 GtkWidget* tree_; |
| 62 GtkListStore* list_store_; |
| 63 GtkTreeSelection* selection_; |
| 64 |
| 65 // Buttons for acting on the table. |
| 66 GtkWidget* add_button_; |
| 67 GtkWidget* edit_button_; |
| 68 GtkWidget* remove_button_; |
| 69 GtkWidget* make_default_button_; |
| 70 |
| 71 // The containing dialog. |
| 72 GtkWidget* dialog_; |
| 73 |
| 74 // The profile. |
| 75 Profile* profile_; |
| 76 |
| 77 // Model containing TemplateURLs. We listen for changes on this and propagate |
| 78 // them to the table model. |
| 79 TemplateURLModel* url_model_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(KeywordEditorView); |
| 82 }; |
| 83 |
| 84 #endif // CHROME_BROWSER_GTK_KEYWORD_EDITOR_VIEW_H_ |
| OLD | NEW |