| 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_COOKIES_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class CookieInfoView; | 27 class CookieInfoView; |
| 28 class CookiesTreeModel; | 28 class CookiesTreeModel; |
| 29 class CookiesTreeView; | 29 class CookiesTreeView; |
| 30 class Profile; | 30 class Profile; |
| 31 class Timer; | 31 class Timer; |
| 32 | 32 |
| 33 | 33 |
| 34 class CookiesView : public views::View, | 34 class CookiesView : public views::View, |
| 35 public views::DialogDelegate, | 35 public views::DialogDelegate, |
| 36 public views::ButtonListener, | 36 public views::ButtonListener, |
| 37 public views::TreeViewController { | 37 public views::TreeViewController, |
| 38 public views::Textfield::Controller { |
| 38 public: | 39 public: |
| 39 // Show the Cookies Window, creating one if necessary. | 40 // Show the Cookies Window, creating one if necessary. |
| 40 static void ShowCookiesWindow(Profile* profile); | 41 static void ShowCookiesWindow(Profile* profile); |
| 41 | 42 |
| 42 virtual ~CookiesView(); | 43 virtual ~CookiesView(); |
| 43 | 44 |
| 45 // Updates the display to show only the search results. |
| 46 void UpdateSearchResults(); |
| 47 |
| 44 // views::ButtonListener implementation. | 48 // views::ButtonListener implementation. |
| 45 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 49 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 46 | 50 |
| 47 // views::TreeViewController implementation. | 51 // views::TreeViewController implementation. |
| 48 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); | 52 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); |
| 49 | 53 |
| 50 // views::TreeViewController implementation. | 54 // views::TreeViewController implementation. |
| 51 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode); | 55 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode); |
| 52 | 56 |
| 57 // views::Textfield::Controller implementation. |
| 58 virtual void ContentsChanged(views::Textfield* sender, |
| 59 const std::wstring& new_contents); |
| 60 virtual bool HandleKeystroke(views::Textfield* sender, |
| 61 const views::Textfield::Keystroke& key); |
| 62 |
| 53 // views::WindowDelegate implementation. | 63 // views::WindowDelegate implementation. |
| 54 virtual int GetDialogButtons() const { | 64 virtual int GetDialogButtons() const { |
| 55 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 65 return MessageBoxFlags::DIALOGBUTTON_CANCEL; |
| 56 } | 66 } |
| 57 virtual views::View* GetInitiallyFocusedView(); | 67 virtual views::View* GetInitiallyFocusedView() { |
| 68 return search_field_; |
| 69 } |
| 58 | 70 |
| 59 virtual bool CanResize() const { return true; } | 71 virtual bool CanResize() const { return true; } |
| 60 virtual std::wstring GetWindowTitle() const; | 72 virtual std::wstring GetWindowTitle() const; |
| 61 virtual void WindowClosing(); | 73 virtual void WindowClosing(); |
| 62 virtual views::View* GetContentsView(); | 74 virtual views::View* GetContentsView(); |
| 63 | 75 |
| 64 // views::View overrides: | 76 // views::View overrides: |
| 65 virtual void Layout(); | 77 virtual void Layout(); |
| 66 virtual gfx::Size GetPreferredSize(); | 78 virtual gfx::Size GetPreferredSize(); |
| 67 | 79 |
| 68 protected: | 80 protected: |
| 69 // views::View overrides: | 81 // views::View overrides: |
| 70 virtual void ViewHierarchyChanged(bool is_add, | 82 virtual void ViewHierarchyChanged(bool is_add, |
| 71 views::View* parent, | 83 views::View* parent, |
| 72 views::View* child); | 84 views::View* child); |
| 73 | 85 |
| 74 private: | 86 private: |
| 75 // Use the static factory method to show. | 87 // Use the static factory method to show. |
| 76 explicit CookiesView(Profile* profile); | 88 explicit CookiesView(Profile* profile); |
| 77 | 89 |
| 78 // Initialize the dialog contents and layout. | 90 // Initialize the dialog contents and layout. |
| 79 void Init(); | 91 void Init(); |
| 80 | 92 |
| 93 // Resets the display to what it would be if there were no search query. |
| 94 void ResetSearchQuery(); |
| 95 |
| 81 // Update the UI when there are no cookies. | 96 // Update the UI when there are no cookies. |
| 82 void UpdateForEmptyState(); | 97 void UpdateForEmptyState(); |
| 83 | 98 |
| 84 // Assorted dialog controls | 99 // Assorted dialog controls |
| 100 views::Label* search_label_; |
| 101 views::Textfield* search_field_; |
| 102 views::NativeButton* clear_search_button_; |
| 85 views::Label* description_label_; | 103 views::Label* description_label_; |
| 86 CookiesTreeView* cookies_tree_; | 104 CookiesTreeView* cookies_tree_; |
| 87 CookieInfoView* info_view_; | 105 CookieInfoView* info_view_; |
| 88 views::NativeButton* remove_button_; | 106 views::NativeButton* remove_button_; |
| 89 views::NativeButton* remove_all_button_; | 107 views::NativeButton* remove_all_button_; |
| 90 | 108 |
| 91 // The Cookies Tree model | 109 // The Cookies Tree model |
| 92 scoped_ptr<CookiesTreeModel> cookies_tree_model_; | 110 scoped_ptr<CookiesTreeModel> cookies_tree_model_; |
| 93 | 111 |
| 94 // The Profile for which Cookies are displayed | 112 // The Profile for which Cookies are displayed |
| 95 Profile* profile_; | 113 Profile* profile_; |
| 96 | 114 |
| 115 // A factory to construct Runnable Methods so that we can be called back to |
| 116 // re-evaluate the model after the search query string changes. |
| 117 ScopedRunnableMethodFactory<CookiesView> search_update_factory_; |
| 118 |
| 97 // Our containing window. If this is non-NULL there is a visible Cookies | 119 // Our containing window. If this is non-NULL there is a visible Cookies |
| 98 // window somewhere. | 120 // window somewhere. |
| 99 static views::Window* instance_; | 121 static views::Window* instance_; |
| 100 | 122 |
| 101 DISALLOW_COPY_AND_ASSIGN(CookiesView); | 123 DISALLOW_COPY_AND_ASSIGN(CookiesView); |
| 102 }; | 124 }; |
| 103 | 125 |
| 104 /////////////////////////////////////////////////////////////////////////////// | 126 /////////////////////////////////////////////////////////////////////////////// |
| 105 // CookieInfoView | 127 // CookieInfoView |
| 106 // | 128 // |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 views::Textfield* send_for_value_field_; | 166 views::Textfield* send_for_value_field_; |
| 145 views::Label* created_label_; | 167 views::Label* created_label_; |
| 146 views::Textfield* created_value_field_; | 168 views::Textfield* created_value_field_; |
| 147 views::Label* expires_label_; | 169 views::Label* expires_label_; |
| 148 views::Textfield* expires_value_field_; | 170 views::Textfield* expires_value_field_; |
| 149 | 171 |
| 150 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); | 172 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); |
| 151 }; | 173 }; |
| 152 | 174 |
| 153 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 175 #endif // CHROME_BROWSER_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| OLD | NEW |