| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "chrome/browser/cookies_tree_model.h" | 12 #include "chrome/browser/cookies_tree_model.h" |
| 13 #include "net/base/cookie_monster.h" | 13 #include "net/base/cookie_monster.h" |
| 14 #include "views/controls/button/button.h" | 14 #include "views/controls/button/button.h" |
| 15 #include "views/controls/textfield/textfield_controller.h" |
| 15 #include "views/controls/tree/tree_view.h" | 16 #include "views/controls/tree/tree_view.h" |
| 16 #include "views/controls/textfield/textfield.h" | |
| 17 #include "views/view.h" | 17 #include "views/view.h" |
| 18 #include "views/window/dialog_delegate.h" | 18 #include "views/window/dialog_delegate.h" |
| 19 #include "views/window/window.h" | 19 #include "views/window/window.h" |
| 20 | 20 |
| 21 class AppCacheInfoView; | 21 class AppCacheInfoView; |
| 22 class CookieInfoView; | 22 class CookieInfoView; |
| 23 class CookiesTreeView; | 23 class CookiesTreeView; |
| 24 class DatabaseInfoView; | 24 class DatabaseInfoView; |
| 25 class IndexedDBInfoView; | 25 class IndexedDBInfoView; |
| 26 class LocalStorageInfoView; | 26 class LocalStorageInfoView; |
| 27 class Profile; | 27 class Profile; |
| 28 class Timer; | 28 class Timer; |
| 29 | 29 |
| 30 namespace ui { | 30 namespace ui { |
| 31 class TreeModel; | 31 class TreeModel; |
| 32 class TreeModelNode; | 32 class TreeModelNode; |
| 33 } // namespace ui | 33 } // namespace ui |
| 34 | 34 |
| 35 namespace views { | 35 namespace views { |
| 36 class Label; | 36 class Label; |
| 37 class NativeButton; | 37 class NativeButton; |
| 38 } // namespace views | 38 } // namespace views |
| 39 | 39 |
| 40 class CookiesView : public CookiesTreeModel::Observer, | 40 class CookiesView : public CookiesTreeModel::Observer, |
| 41 public views::View, | 41 public views::View, |
| 42 public views::DialogDelegate, | 42 public views::DialogDelegate, |
| 43 public views::ButtonListener, | 43 public views::ButtonListener, |
| 44 public views::TreeViewController, | 44 public views::TreeViewController, |
| 45 public views::Textfield::Controller { | 45 public views::TextfieldController { |
| 46 public: | 46 public: |
| 47 // Show the Cookies Window, creating one if necessary. | 47 // Show the Cookies Window, creating one if necessary. |
| 48 static void ShowCookiesWindow(Profile* profile); | 48 static void ShowCookiesWindow(Profile* profile); |
| 49 | 49 |
| 50 virtual ~CookiesView(); | 50 virtual ~CookiesView(); |
| 51 | 51 |
| 52 // Updates the display to show only the search results. | 52 // Updates the display to show only the search results. |
| 53 void UpdateSearchResults(); | 53 void UpdateSearchResults(); |
| 54 | 54 |
| 55 // Begin TreeModelObserver implementation. | 55 // Begin TreeModelObserver implementation. |
| 56 virtual void TreeNodesAdded(ui::TreeModel* model, | 56 virtual void TreeNodesAdded(ui::TreeModel* model, |
| 57 ui::TreeModelNode* parent, | 57 ui::TreeModelNode* parent, |
| 58 int start, | 58 int start, |
| 59 int count); | 59 int count); |
| 60 virtual void TreeNodesRemoved(ui::TreeModel* model, | 60 virtual void TreeNodesRemoved(ui::TreeModel* model, |
| 61 ui::TreeModelNode* parent, | 61 ui::TreeModelNode* parent, |
| 62 int start, | 62 int start, |
| 63 int count) {} | 63 int count) {} |
| 64 virtual void TreeNodeChanged(ui::TreeModel* model, ui::TreeModelNode* node) {} | 64 virtual void TreeNodeChanged(ui::TreeModel* model, ui::TreeModelNode* node) {} |
| 65 // End TreeModelObserver implementation. | 65 // End TreeModelObserver implementation. |
| 66 | 66 |
| 67 // views::ButtonListener implementation. | 67 // views::ButtonListener: |
| 68 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 68 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
| 69 | 69 |
| 70 // views::TreeViewController implementation. | 70 // views::TreeViewController: |
| 71 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); | 71 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); |
| 72 | |
| 73 // views::TreeViewController implementation. | |
| 74 virtual void OnTreeViewKeyDown(ui::KeyboardCode keycode); | 72 virtual void OnTreeViewKeyDown(ui::KeyboardCode keycode); |
| 75 | 73 |
| 76 // views::Textfield::Controller implementation. | 74 // views::TextfieldController: |
| 77 virtual void ContentsChanged(views::Textfield* sender, | 75 virtual void ContentsChanged(views::Textfield* sender, |
| 78 const std::wstring& new_contents); | 76 const std::wstring& new_contents); |
| 79 virtual bool HandleKeyEvent(views::Textfield* sender, | 77 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 80 const views::KeyEvent& key); | 78 const views::KeyEvent& key); |
| 81 | 79 |
| 82 // views::WindowDelegate implementation. | 80 // views::WindowDelegate: |
| 83 virtual int GetDialogButtons() const { | 81 virtual int GetDialogButtons() const; |
| 84 return MessageBoxFlags::DIALOGBUTTON_CANCEL; | 82 virtual views::View* GetInitiallyFocusedView(); |
| 85 } | 83 virtual bool CanResize() const; |
| 86 virtual views::View* GetInitiallyFocusedView() { | |
| 87 return search_field_; | |
| 88 } | |
| 89 | |
| 90 virtual bool CanResize() const { return true; } | |
| 91 virtual std::wstring GetWindowTitle() const; | 84 virtual std::wstring GetWindowTitle() const; |
| 92 virtual void WindowClosing(); | 85 virtual void WindowClosing(); |
| 93 virtual views::View* GetContentsView(); | 86 virtual views::View* GetContentsView(); |
| 94 | 87 |
| 95 // views::View overrides: | 88 // views::View: |
| 96 virtual void Layout(); | 89 virtual void Layout(); |
| 97 virtual gfx::Size GetPreferredSize(); | 90 virtual gfx::Size GetPreferredSize(); |
| 98 | 91 |
| 99 protected: | 92 protected: |
| 100 // views::View overrides: | 93 // views::View: |
| 101 virtual void ViewHierarchyChanged(bool is_add, | 94 virtual void ViewHierarchyChanged(bool is_add, |
| 102 views::View* parent, | 95 views::View* parent, |
| 103 views::View* child); | 96 views::View* child); |
| 104 | 97 |
| 105 private: | 98 private: |
| 106 class InfoPanelView; | 99 class InfoPanelView; |
| 107 | 100 |
| 108 // Use the static factory method to show. | 101 // Use the static factory method to show. |
| 109 explicit CookiesView(Profile* profile); | 102 explicit CookiesView(Profile* profile); |
| 110 | 103 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 ScopedRunnableMethodFactory<CookiesView> search_update_factory_; | 142 ScopedRunnableMethodFactory<CookiesView> search_update_factory_; |
| 150 | 143 |
| 151 // Our containing window. If this is non-NULL there is a visible Cookies | 144 // Our containing window. If this is non-NULL there is a visible Cookies |
| 152 // window somewhere. | 145 // window somewhere. |
| 153 static views::Window* instance_; | 146 static views::Window* instance_; |
| 154 | 147 |
| 155 DISALLOW_COPY_AND_ASSIGN(CookiesView); | 148 DISALLOW_COPY_AND_ASSIGN(CookiesView); |
| 156 }; | 149 }; |
| 157 | 150 |
| 158 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ | 151 #endif // CHROME_BROWSER_UI_VIEWS_OPTIONS_COOKIES_VIEW_H_ |
| OLD | NEW |