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.
5 #ifndef CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
6 #define CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_
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"
16 class EditSearchEngineController
;
17 class EditSearchEngineControllerDelegate
;
21 class EditSearchEngineDialog
{
23 EditSearchEngineDialog(GtkWindow
* parent_window
,
24 TemplateURL
* template_url
,
25 EditSearchEngineControllerDelegate
* delegate
,
27 ~EditSearchEngineDialog();
30 // Create and show the window.
31 void Init(GtkWindow
* parent_window
, Profile
* profile
);
33 // Retrieve the user input in the various fields.
34 base::string16
GetTitleInput() const;
35 base::string16
GetKeywordInput() const;
36 std::string
GetURLInput() const;
38 // Set sensitivity of buttons based on entry state.
39 void EnableControls();
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
);
46 // Callback for entry changes.
47 CHROMEG_CALLBACK_0(EditSearchEngineDialog
, void, OnEntryChanged
,
50 // Callback for dialog buttons.
51 CHROMEGTK_CALLBACK_1(EditSearchEngineDialog
, void, OnResponse
, int);
53 // Callback for window destruction.
54 CHROMEGTK_CALLBACK_0(EditSearchEngineDialog
, void, OnWindowDestroy
);
59 // Text entries for each field.
60 GtkWidget
* title_entry_
;
61 GtkWidget
* keyword_entry_
;
62 GtkWidget
* url_entry_
;
64 // Images showing whether each entry is okay or has errors.
65 GtkWidget
* title_image_
;
66 GtkWidget
* keyword_image_
;
67 GtkWidget
* url_image_
;
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_
;
73 scoped_ptr
<EditSearchEngineController
> controller_
;
75 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog
);
78 #endif // CHROME_BROWSER_UI_GTK_EDIT_SEARCH_ENGINE_DIALOG_H_