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