OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CONTENT_SETTINGS_WINDOW_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/pref_member.h" | 8 #include "chrome/browser/pref_member.h" |
9 #include "chrome/common/content_settings_types.h" | 9 #include "chrome/common/content_settings_types.h" |
10 #include "views/controls/tabbed_pane/tabbed_pane.h" | 10 #include "views/controls/listbox/listbox.h" |
11 #include "views/view.h" | 11 #include "views/view.h" |
12 #include "views/window/dialog_delegate.h" | 12 #include "views/window/dialog_delegate.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 class MessageLoop; | 15 class MessageLoop; |
16 class OptionsPageView; | 16 class OptionsPageView; |
17 | 17 |
| 18 namespace views { |
| 19 class Label; |
| 20 } // namespace views |
| 21 |
18 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
19 // ContentSettingsWindowView | 23 // ContentSettingsWindowView |
20 // | 24 // |
21 // The contents of the Options dialog window. | 25 // The contents of the Options dialog window. |
22 // | 26 // |
23 class ContentSettingsWindowView : public views::View, | 27 class ContentSettingsWindowView : public views::View, |
24 public views::DialogDelegate, | 28 public views::DialogDelegate, |
25 public views::TabbedPane::Listener { | 29 public views::Listbox::Listener { |
26 public: | 30 public: |
27 explicit ContentSettingsWindowView(Profile* profile); | 31 explicit ContentSettingsWindowView(Profile* profile); |
28 virtual ~ContentSettingsWindowView(); | 32 virtual ~ContentSettingsWindowView(); |
29 | 33 |
30 // Shows the Tab corresponding to the specified Content Settings page. | 34 // Shows the Tab corresponding to the specified Content Settings page. |
31 void ShowContentSettingsTab(ContentSettingsType page); | 35 void ShowContentSettingsTab(ContentSettingsType page); |
32 | 36 |
33 protected: | 37 protected: |
34 // views::View overrides: | 38 // views::View overrides: |
35 virtual void Layout(); | 39 virtual void Layout(); |
36 virtual gfx::Size GetPreferredSize(); | 40 virtual gfx::Size GetPreferredSize(); |
37 virtual void ViewHierarchyChanged(bool is_add, | 41 virtual void ViewHierarchyChanged(bool is_add, |
38 views::View* parent, | 42 views::View* parent, |
39 views::View* child); | 43 views::View* child); |
40 | 44 |
41 // views::DialogDelegate implementation: | 45 // views::DialogDelegate implementation: |
42 virtual int GetDialogButtons() const { | 46 virtual int GetDialogButtons() const { |
43 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 47 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
44 } | 48 } |
45 virtual std::wstring GetWindowTitle() const; | 49 virtual std::wstring GetWindowTitle() const; |
46 virtual void WindowClosing(); | 50 virtual void WindowClosing(); |
47 virtual bool Cancel(); | 51 virtual bool Cancel(); |
48 virtual views::View* GetContentsView(); | 52 virtual views::View* GetContentsView(); |
49 | 53 |
50 // views::TabbedPane::Listener implementation: | 54 // views::Listbox::Listener implementation: |
51 virtual void TabSelectedAt(int index); | 55 virtual void ListboxSelectionChanged(views::Listbox* sender); |
52 | 56 |
53 private: | 57 private: |
54 // Initializes the view. | 58 // Initializes the view. |
55 void Init(); | 59 void Init(); |
56 | 60 |
| 61 // Makes |pages_[page]| the currently visible page. |
| 62 void ShowSettingsPage(int page); |
| 63 |
57 // Returns the currently selected OptionsPageView. | 64 // Returns the currently selected OptionsPageView. |
58 const OptionsPageView* GetCurrentContentSettingsTabView() const; | 65 const OptionsPageView* GetCurrentContentSettingsTabView() const; |
59 | 66 |
60 // The Tab view that contains all of the options pages. | |
61 views::TabbedPane* tabs_; | |
62 | |
63 // The Profile associated with these options. | 67 // The Profile associated with these options. |
64 Profile* profile_; | 68 Profile* profile_; |
65 | 69 |
| 70 // The label above the left box. |
| 71 views::Label* label_; |
| 72 |
| 73 // The listbox used to select a page. |
| 74 views::Listbox* listbox_; |
| 75 |
66 // The last page the user was on when they opened the Options window. | 76 // The last page the user was on when they opened the Options window. |
67 IntegerPrefMember last_selected_page_; | 77 IntegerPrefMember last_selected_page_; |
68 | 78 |
| 79 // Stores the index of the currently visible page. |
| 80 int current_page_; |
| 81 |
| 82 // Stores the possible content pages displayed on the right. |
| 83 // |pages_[current_page_]| is the currently displayed page, and it's the only |
| 84 // parented View in |pages_|. |
| 85 std::vector<View*> pages_; |
| 86 |
69 DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowView); | 87 DISALLOW_COPY_AND_ASSIGN(ContentSettingsWindowView); |
70 }; | 88 }; |
71 | 89 |
72 #endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_ | 90 #endif // CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_SETTINGS_WINDOW_VIEW_H_ |
73 | 91 |
OLD | NEW |