| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/shell_integration.h" |
| 8 #include "chrome/browser/views/options/options_page_view.h" | 9 #include "chrome/browser/views/options/options_page_view.h" |
| 9 #include "chrome/browser/views/shelf_item_dialog.h" | 10 #include "chrome/browser/views/shelf_item_dialog.h" |
| 10 #include "chrome/common/pref_member.h" | 11 #include "chrome/common/pref_member.h" |
| 11 #include "views/controls/combobox/combobox.h" | 12 #include "views/controls/combobox/combobox.h" |
| 12 #include "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
| 13 #include "views/controls/table/table_view_observer.h" | 14 #include "views/controls/table/table_view_observer.h" |
| 14 #include "views/view.h" | 15 #include "views/view.h" |
| 15 | 16 |
| 16 namespace views { | 17 namespace views { |
| 17 class Checkbox; | 18 class Checkbox; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 28 class TableModel; | 29 class TableModel; |
| 29 | 30 |
| 30 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
| 31 // GeneralPageView | 32 // GeneralPageView |
| 32 | 33 |
| 33 class GeneralPageView : public OptionsPageView, | 34 class GeneralPageView : public OptionsPageView, |
| 34 public views::Combobox::Listener, | 35 public views::Combobox::Listener, |
| 35 public views::ButtonListener, | 36 public views::ButtonListener, |
| 36 public views::Textfield::Controller, | 37 public views::Textfield::Controller, |
| 37 public ShelfItemDialogDelegate, | 38 public ShelfItemDialogDelegate, |
| 38 public views::TableViewObserver { | 39 public views::TableViewObserver, |
| 40 public ShellIntegration::DefaultBrowserObserver { |
| 39 public: | 41 public: |
| 40 explicit GeneralPageView(Profile* profile); | 42 explicit GeneralPageView(Profile* profile); |
| 41 virtual ~GeneralPageView(); | 43 virtual ~GeneralPageView(); |
| 42 | 44 |
| 43 protected: | 45 protected: |
| 44 // views::ButtonListener implementation: | 46 // views::ButtonListener implementation: |
| 45 virtual void ButtonPressed(views::Button* sender); | 47 virtual void ButtonPressed(views::Button* sender); |
| 46 | 48 |
| 47 // views::Combobox::Listener implementation: | 49 // views::Combobox::Listener implementation: |
| 48 virtual void ItemChanged(views::Combobox* combobox, | 50 virtual void ItemChanged(views::Combobox* combobox, |
| 49 int prev_index, | 51 int prev_index, |
| 50 int new_index); | 52 int new_index); |
| 51 | 53 |
| 52 // views::Textfield::Controller implementation: | 54 // views::Textfield::Controller implementation: |
| 53 virtual void ContentsChanged(views::Textfield* sender, | 55 virtual void ContentsChanged(views::Textfield* sender, |
| 54 const std::wstring& new_contents); | 56 const std::wstring& new_contents); |
| 55 virtual bool HandleKeystroke(views::Textfield* sender, | 57 virtual bool HandleKeystroke(views::Textfield* sender, |
| 56 const views::Textfield::Keystroke& key); | 58 const views::Textfield::Keystroke& key); |
| 57 | 59 |
| 58 // OptionsPageView implementation: | 60 // OptionsPageView implementation: |
| 59 virtual void InitControlLayout(); | 61 virtual void InitControlLayout(); |
| 60 virtual void NotifyPrefChanged(const std::wstring* pref_name); | 62 virtual void NotifyPrefChanged(const std::wstring* pref_name); |
| 61 virtual void HighlightGroup(OptionsGroup highlight_group); | 63 virtual void HighlightGroup(OptionsGroup highlight_group); |
| 62 | 64 |
| 63 // views::View overrides: | 65 // views::View overrides: |
| 64 virtual void Layout(); | 66 virtual void Layout(); |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 // The current default browser UI state | 69 // ShellIntegration::DefaultBrowserObserver implementation: |
| 68 enum DefaultBrowserUIState { | |
| 69 STATE_PROCESSING, | |
| 70 STATE_DEFAULT, | |
| 71 STATE_NOT_DEFAULT | |
| 72 }; | |
| 73 // Updates the UI state to reflect the current default browser state. | 70 // Updates the UI state to reflect the current default browser state. |
| 74 void SetDefaultBrowserUIState(DefaultBrowserUIState state); | 71 virtual void SetDefaultBrowserUIState(ShellIntegration::DefaultBrowserUIState
state); |
| 75 | 72 |
| 76 // Init all the dialog controls | 73 // Init all the dialog controls |
| 77 void InitStartupGroup(); | 74 void InitStartupGroup(); |
| 78 void InitHomepageGroup(); | 75 void InitHomepageGroup(); |
| 79 void InitDefaultSearchGroup(); | 76 void InitDefaultSearchGroup(); |
| 80 void InitDefaultBrowserGroup(); | 77 void InitDefaultBrowserGroup(); |
| 81 | 78 |
| 82 // Saves the startup preference from that of the ui. | 79 // Saves the startup preference from that of the ui. |
| 83 void SaveStartupPref(); | 80 void SaveStartupPref(); |
| 84 | 81 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 views::Combobox* default_search_engine_combobox_; | 141 views::Combobox* default_search_engine_combobox_; |
| 145 views::NativeButton* default_search_manage_engines_button_; | 142 views::NativeButton* default_search_manage_engines_button_; |
| 146 scoped_ptr<SearchEngineListModel> default_search_engines_model_; | 143 scoped_ptr<SearchEngineListModel> default_search_engines_model_; |
| 147 | 144 |
| 148 // Controls for the Default Browser group | 145 // Controls for the Default Browser group |
| 149 OptionsGroupView* default_browser_group_; | 146 OptionsGroupView* default_browser_group_; |
| 150 views::Label* default_browser_status_label_; | 147 views::Label* default_browser_status_label_; |
| 151 views::NativeButton* default_browser_use_as_default_button_; | 148 views::NativeButton* default_browser_use_as_default_button_; |
| 152 | 149 |
| 153 // The helper object that performs default browser set/check tasks. | 150 // The helper object that performs default browser set/check tasks. |
| 154 class DefaultBrowserWorker; | 151 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; |
| 155 friend DefaultBrowserWorker; | |
| 156 scoped_refptr<DefaultBrowserWorker> default_browser_worker_; | |
| 157 | 152 |
| 158 DISALLOW_COPY_AND_ASSIGN(GeneralPageView); | 153 DISALLOW_COPY_AND_ASSIGN(GeneralPageView); |
| 159 }; | 154 }; |
| 160 | 155 |
| 161 #endif // CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ | 156 #endif // CHROME_BROWSER_VIEWS_OPTIONS_GENERAL_PAGE_VIEW_H_ |
| OLD | NEW |