Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Side by Side Diff: chrome/browser/ui/views/cookie_info_view.h

Issue 8607001: views: Factor out Listener from Combobox into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sky review Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_COOKIE_INFO_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
12 #include "base/string16.h" 14 #include "base/string16.h"
13 #include "net/base/cookie_monster.h" 15 #include "net/base/cookie_monster.h"
14 #include "ui/base/models/combobox_model.h" 16 #include "ui/base/models/combobox_model.h"
15 #include "views/controls/combobox/combobox.h" 17 #include "views/controls/combobox/combobox_listener.h"
16 #include "views/view.h" 18 #include "views/view.h"
17 19
18 namespace views { 20 namespace views {
19 class GridLayout; 21 class GridLayout;
20 class Label; 22 class Label;
21 class Textfield; 23 class Textfield;
22 } 24 }
23 25
24 26
25 /////////////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////////////
26 // CookieInfoViewDelegate 28 // CookieInfoViewDelegate
27 // 29 //
28 class CookieInfoViewDelegate { 30 class CookieInfoViewDelegate {
29 public: 31 public:
30 virtual void ModifyExpireDate(bool session_expire) = 0; 32 virtual void ModifyExpireDate(bool session_expire) = 0;
31 33
32 protected: 34 protected:
33 virtual ~CookieInfoViewDelegate() {} 35 virtual ~CookieInfoViewDelegate() {}
34 }; 36 };
35 37
36 /////////////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////////////
37 // CookieInfoView 39 // CookieInfoView
38 // 40 //
39 // Responsible for displaying a tabular grid of Cookie information. 41 // Responsible for displaying a tabular grid of Cookie information.
40 class CookieInfoView : public views::View, 42 class CookieInfoView : public views::View,
41 public views::Combobox::Listener, 43 public views::ComboboxListener,
42 public ui::ComboboxModel { 44 public ui::ComboboxModel {
43 public: 45 public:
44 explicit CookieInfoView(bool editable_expiration_date); 46 explicit CookieInfoView(bool editable_expiration_date);
45 virtual ~CookieInfoView(); 47 virtual ~CookieInfoView();
46 48
47 // Update the display from the specified CookieNode. 49 // Update the display from the specified CookieNode.
48 void SetCookie(const std::string& domain, 50 void SetCookie(const std::string& domain,
49 const net::CookieMonster::CanonicalCookie& cookie_node); 51 const net::CookieMonster::CanonicalCookie& cookie_node);
50 52
51 // Update the display from the specified cookie string. 53 // Update the display from the specified cookie string.
52 void SetCookieString(const GURL& url, const std::string& cookie_line); 54 void SetCookieString(const GURL& url, const std::string& cookie_line);
53 55
54 // Clears the cookie display to indicate that no or multiple cookies are 56 // Clears the cookie display to indicate that no or multiple cookies are
55 // selected. 57 // selected.
56 void ClearCookieDisplay(); 58 void ClearCookieDisplay();
57 59
58 // Enables or disables the cookie property text fields. 60 // Enables or disables the cookie property text fields.
59 void EnableCookieDisplay(bool enabled); 61 void EnableCookieDisplay(bool enabled);
60 62
61 void set_delegate(CookieInfoViewDelegate* delegate) { delegate_ = delegate; } 63 void set_delegate(CookieInfoViewDelegate* delegate) { delegate_ = delegate; }
62 64
63 protected: 65 protected:
64 // views::View overrides: 66 // views::View:
65 virtual void ViewHierarchyChanged(bool is_add, 67 virtual void ViewHierarchyChanged(bool is_add,
66 views::View* parent, 68 views::View* parent,
67 views::View* child); 69 views::View* child) OVERRIDE;
68 70
69 // views::Combobox::Listener override. 71 // views::ComboboxListener:
70 virtual void ItemChanged(views::Combobox* combo_box, 72 virtual void ItemChanged(views::Combobox* combo_box,
71 int prev_index, 73 int prev_index,
72 int new_index); 74 int new_index) OVERRIDE;
73 75
74 // ui::ComboboxModel overrides for expires_value_combobox_. 76 // ui::ComboboxModel:
75 virtual int GetItemCount(); 77 virtual int GetItemCount() OVERRIDE;
76 virtual string16 GetItemAt(int index); 78 virtual string16 GetItemAt(int index) OVERRIDE;
77 79
78 private: 80 private:
79 // Layout helper routines. 81 // Layout helper routines.
80 void AddLabelRow(int layout_id, views::GridLayout* layout, 82 void AddLabelRow(int layout_id, views::GridLayout* layout,
81 views::View* label, views::View* value); 83 views::View* label, views::View* value);
82 void AddControlRow(int layout_id, views::GridLayout* layout, 84 void AddControlRow(int layout_id, views::GridLayout* layout,
83 views::View* label, views::View* control); 85 views::View* label, views::View* control);
84 86
85 // Sets up the view layout. 87 // Sets up the view layout.
86 void Init(); 88 void Init();
(...skipping 25 matching lines...) Expand all
112 // CookiesPromptView (alert before cookie is set), in all other cases we 114 // CookiesPromptView (alert before cookie is set), in all other cases we
113 // don't let user directly change cookie setting. 115 // don't let user directly change cookie setting.
114 bool editable_expiration_date_; 116 bool editable_expiration_date_;
115 117
116 CookieInfoViewDelegate* delegate_; 118 CookieInfoViewDelegate* delegate_;
117 119
118 DISALLOW_COPY_AND_ASSIGN(CookieInfoView); 120 DISALLOW_COPY_AND_ASSIGN(CookieInfoView);
119 }; 121 };
120 122
121 #endif // CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_ 123 #endif // CHROME_BROWSER_UI_VIEWS_COOKIE_INFO_VIEW_H_
122
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc ('k') | chrome/browser/ui/views/cookie_info_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698