| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_ |
| 11 #define CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ | 11 #define CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include <windows.h> | 14 #include <windows.h> |
| 15 | 15 |
| 16 #include "views/controls/textfield/textfield.h" | 16 #include "views/controls/textfield/textfield_controller.h" |
| 17 #include "views/window/dialog_delegate.h" | 17 #include "views/window/dialog_delegate.h" |
| 18 | 18 |
| 19 namespace views { | 19 namespace views { |
| 20 class Label; | 20 class Label; |
| 21 class ImageView; | 21 class ImageView; |
| 22 class Window; | 22 class Window; |
| 23 } | 23 } |
| 24 | 24 |
| 25 class EditSearchEngineController; | 25 class EditSearchEngineController; |
| 26 class EditSearchEngineControllerDelegate; | 26 class EditSearchEngineControllerDelegate; |
| 27 class Profile; | 27 class Profile; |
| 28 class TemplateURL; | 28 class TemplateURL; |
| 29 class TemplateURLModel; | 29 class TemplateURLModel; |
| 30 | 30 |
| 31 class EditSearchEngineDialog : public views::View, | 31 class EditSearchEngineDialog : public views::View, |
| 32 public views::Textfield::Controller, | 32 public views::TextfieldController, |
| 33 public views::DialogDelegate { | 33 public views::DialogDelegate { |
| 34 public: | 34 public: |
| 35 // The |template_url| and/or |delegate| may be NULL. | 35 // The |template_url| and/or |delegate| may be NULL. |
| 36 EditSearchEngineDialog(const TemplateURL* template_url, | 36 EditSearchEngineDialog(const TemplateURL* template_url, |
| 37 EditSearchEngineControllerDelegate* delegate, | 37 EditSearchEngineControllerDelegate* delegate, |
| 38 Profile* profile); | 38 Profile* profile); |
| 39 virtual ~EditSearchEngineDialog() {} | 39 virtual ~EditSearchEngineDialog() {} |
| 40 | 40 |
| 41 // Shows the dialog to the user. | 41 // Shows the dialog to the user. |
| 42 static void Show(gfx::NativeWindow parent, | 42 static void Show(gfx::NativeWindow parent, |
| 43 const TemplateURL* template_url, | 43 const TemplateURL* template_url, |
| 44 EditSearchEngineControllerDelegate* delegate, | 44 EditSearchEngineControllerDelegate* delegate, |
| 45 Profile* profile); | 45 Profile* profile); |
| 46 | 46 |
| 47 // views::DialogDelegate overrides. | 47 // views::DialogDelegate: |
| 48 virtual bool IsModal() const; | 48 virtual bool IsModal() const; |
| 49 virtual std::wstring GetWindowTitle() const; | 49 virtual std::wstring GetWindowTitle() const; |
| 50 virtual bool IsDialogButtonEnabled( | 50 virtual bool IsDialogButtonEnabled( |
| 51 MessageBoxFlags::DialogButton button) const; | 51 MessageBoxFlags::DialogButton button) const; |
| 52 virtual bool Cancel(); | 52 virtual bool Cancel(); |
| 53 virtual bool Accept(); | 53 virtual bool Accept(); |
| 54 virtual views::View* GetContentsView(); | 54 virtual views::View* GetContentsView(); |
| 55 | 55 |
| 56 // views::Textfield::Controller overrides. Updates whether the user can | 56 // views::TextfieldController: |
| 57 // accept the dialog as well as updating image views showing whether value is | 57 // Updates whether the user can accept the dialog as well as updating image |
| 58 // valid. | 58 // views showing whether value is valid. |
| 59 virtual void ContentsChanged(views::Textfield* sender, | 59 virtual void ContentsChanged(views::Textfield* sender, |
| 60 const std::wstring& new_contents); | 60 const std::wstring& new_contents); |
| 61 virtual bool HandleKeyEvent(views::Textfield* sender, | 61 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 62 const views::KeyEvent& key_event); | 62 const views::KeyEvent& key_event); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 void Init(); | 65 void Init(); |
| 66 | 66 |
| 67 // Create a Label containing the text with the specified message id. | 67 // Create a Label containing the text with the specified message id. |
| 68 views::Label* CreateLabel(int message_id); | 68 views::Label* CreateLabel(int message_id); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 96 views::ImageView* title_iv_; | 96 views::ImageView* title_iv_; |
| 97 views::ImageView* keyword_iv_; | 97 views::ImageView* keyword_iv_; |
| 98 views::ImageView* url_iv_; | 98 views::ImageView* url_iv_; |
| 99 | 99 |
| 100 scoped_ptr<EditSearchEngineController> controller_; | 100 scoped_ptr<EditSearchEngineController> controller_; |
| 101 | 101 |
| 102 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); | 102 DISALLOW_COPY_AND_ASSIGN(EditSearchEngineDialog); |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 #endif // CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ | 105 #endif // CHROME_BROWSER_UI_VIEWS_EDIT_SEARCH_ENGINE_DIALOG_H_ |
| OLD | NEW |