| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ | |
| 6 #define CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ | |
| 7 | |
| 8 #include <gtk/gtk.h> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/strings/string16.h" | |
| 14 #include "ui/base/gtk/gtk_signal.h" | |
| 15 | |
| 16 class EditSearchEngineController; | |
| 17 class EditSearchEngineControllerDelegate; | |
| 18 class Profile; | |
| 19 class TemplateURL; | |
| 20 | |
| 21 class EditSearchEngineDialog { | |
| 22 public: | |
| 23 EditSearchEngineDialog(GtkWindow* parent_window, | |
| 24 TemplateURL* template_url, | |
| 25 EditSearchEngineControllerDelegate* delegate, | |
| 26 Profile* profile); | |
| 27 ~EditSearchEngineDialog(); | |
| 28 | |
| 29 private: | |
| 30 // Create and show the window. | |
| 31 void Init(GtkWindow* parent_window, Profile* profile); | |
| 32 | |
| 33 // Retrieve the user input in the various fields. | |
| 34 base::string16 GetTitleInput() const; | |
| 35 base::string16 GetKeywordInput() const; | |
| 36 std::string GetURLInput() const; | |
| 37 | |
| 38 // Set sensitivity of buttons based on entry state. | |
| 39 void EnableControls(); | |
| 40 | |
| 41 // Updates the tooltip and image of the image view based on is_valid. If | |
| 42 // is_valid is false the tooltip of the image view is set to the message with | |
| 43 // id invalid_message_id, otherwise the tooltip is set to the empty text. | |
| 44 void UpdateImage(GtkWidget* image, bool is_valid, int invalid_message_id); | |
| 45 | |
| 46 // Callback for entry changes. | |
| 47 CHROMEG_CALLBACK_0(EditSearchEngineDialog, void, OnEntryChanged, | |
| 48 GtkEditable*); | |
| 49 | |
| 50 // Callback for dialog buttons. | |
| 51 CHROMEGTK_CALLBACK_1(EditSearchEngineDialog, void, OnResponse, int); | |
| 52 | |
| 53 // Callback for window destruction. | |
| 54 CHROMEGTK_CALLBACK_0(EditSearchEngineDialog, void, OnWindowDestroy); | |
| 55 | |
| 56 // The dialog window. | |
| 57 GtkWidget* dialog_; | |
| 58 | |
| 59 // Text entries for each field. | |
| 60 GtkWidget* title_entry_; | |
| 61 GtkWidget* keyword_entry_; | |
| 62 GtkWidget* url_entry_; | |
| 63 | |
| 64 // Images showing whether each entry is okay or has errors. | |
| 65 GtkWidget* title_image_; | |
| 66 GtkWidget* keyword_image_; | |
| 67 GtkWidget* url_image_; | |
| 68 | |
| 69 // The ok button (we need a reference to it so we can de-activate it when the | |
| 70 // entries are not all filled in.) | |
| 71 GtkWidget* ok_button_; | |
| 72 | |
| 73 scoped_ptr<EditSearchEngineController> controller_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); | |
| 76 }; | |
| 77 | |
| 78 #endif // CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_ | |
| OLD | NEW |