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 // EditSearchEngineDialog provides text fields for editing a keyword: the title, | 5 // EditSearchEngineDialog provides text fields for editing a keyword: the title, |
6 // url and actual keyword. It is used by the KeywordEditorView of the Options | 6 // url and actual keyword. It is used by the KeywordEditorView of the Options |
7 // dialog, and also on its own to confirm the addition of a keyword added by | 7 // dialog, and also on its own to confirm the addition of a keyword added by |
8 // the ExternalJSObject via the RenderView. | 8 // the ExternalJSObject via the RenderView. |
9 | 9 |
10 #ifndef CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ | 10 #ifndef CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ |
(...skipping 12 matching lines...) Expand all Loading... |
23 class Profile; | 23 class Profile; |
24 class TemplateURL; | 24 class TemplateURL; |
25 | 25 |
26 class EditSearchEngineDialog : public views::TextfieldController, | 26 class EditSearchEngineDialog : public views::TextfieldController, |
27 public views::DialogDelegateView { | 27 public views::DialogDelegateView { |
28 public: | 28 public: |
29 // The |template_url| and/or |delegate| may be NULL. | 29 // The |template_url| and/or |delegate| may be NULL. |
30 EditSearchEngineDialog(TemplateURL* template_url, | 30 EditSearchEngineDialog(TemplateURL* template_url, |
31 EditSearchEngineControllerDelegate* delegate, | 31 EditSearchEngineControllerDelegate* delegate, |
32 Profile* profile); | 32 Profile* profile); |
33 virtual ~EditSearchEngineDialog(); | 33 ~EditSearchEngineDialog() override; |
34 | 34 |
35 // Shows the dialog to the user. | 35 // Shows the dialog to the user. |
36 static void Show(gfx::NativeWindow parent, | 36 static void Show(gfx::NativeWindow parent, |
37 TemplateURL* template_url, | 37 TemplateURL* template_url, |
38 EditSearchEngineControllerDelegate* delegate, | 38 EditSearchEngineControllerDelegate* delegate, |
39 Profile* profile); | 39 Profile* profile); |
40 | 40 |
41 // views::DialogDelegate: | 41 // views::DialogDelegate: |
42 virtual ui::ModalType GetModalType() const override; | 42 ui::ModalType GetModalType() const override; |
43 virtual base::string16 GetWindowTitle() const override; | 43 base::string16 GetWindowTitle() const override; |
44 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 44 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
45 virtual bool Cancel() override; | 45 bool Cancel() override; |
46 virtual bool Accept() override; | 46 bool Accept() override; |
47 | 47 |
48 // views::TextfieldController: | 48 // views::TextfieldController: |
49 // Updates whether the user can accept the dialog as well as updating image | 49 // Updates whether the user can accept the dialog as well as updating image |
50 // views showing whether value is valid. | 50 // views showing whether value is valid. |
51 virtual void ContentsChanged(views::Textfield* sender, | 51 void ContentsChanged(views::Textfield* sender, |
52 const base::string16& new_contents) override; | 52 const base::string16& new_contents) override; |
53 virtual bool HandleKeyEvent(views::Textfield* sender, | 53 bool HandleKeyEvent(views::Textfield* sender, |
54 const ui::KeyEvent& key_event) override; | 54 const ui::KeyEvent& key_event) override; |
| 55 |
55 private: | 56 private: |
56 void Init(); | 57 void Init(); |
57 | 58 |
58 // Create a Label containing the text with the specified message id. | 59 // Create a Label containing the text with the specified message id. |
59 views::Label* CreateLabel(int message_id); | 60 views::Label* CreateLabel(int message_id); |
60 | 61 |
61 // Creates a text field with the specified text. | 62 // Creates a text field with the specified text. |
62 views::Textfield* CreateTextfield(const base::string16& text); | 63 views::Textfield* CreateTextfield(const base::string16& text); |
63 | 64 |
64 // Invokes UpdateImageView for each of the images views. | 65 // Invokes UpdateImageView for each of the images views. |
(...skipping 15 matching lines...) Expand all Loading... |
80 views::ImageView* title_iv_; | 81 views::ImageView* title_iv_; |
81 views::ImageView* keyword_iv_; | 82 views::ImageView* keyword_iv_; |
82 views::ImageView* url_iv_; | 83 views::ImageView* url_iv_; |
83 | 84 |
84 scoped_ptr<EditSearchEngineController> controller_; | 85 scoped_ptr<EditSearchEngineController> controller_; |
85 | 86 |
86 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); | 87 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); |
87 }; | 88 }; |
88 | 89 |
89 #endif // CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ | 90 #endif // CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ |
OLD | NEW |