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

Side by Side Diff: chrome/browser/views/bookmark_bubble_view.h

Issue 113991: Make Combobox portable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/views/bookmark_bubble_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_BOOKMARK_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
7 7
8 #include "base/gfx/rect.h" 8 #include "base/gfx/rect.h"
9 #include "chrome/browser/views/info_bubble.h" 9 #include "chrome/browser/views/info_bubble.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "views/controls/button/button.h" 11 #include "views/controls/button/button.h"
12 #include "views/controls/combo_box.h" 12 #include "views/controls/combobox/combobox.h"
13 #include "views/controls/link.h" 13 #include "views/controls/link.h"
14 #include "views/view.h" 14 #include "views/view.h"
15 15
16 class Profile; 16 class Profile;
17 17
18 class BookmarkModel; 18 class BookmarkModel;
19 class BookmarkNode; 19 class BookmarkNode;
20 20
21 namespace views { 21 namespace views {
22 class NativeButton; 22 class NativeButton;
23 class Textfield; 23 class Textfield;
24 } 24 }
25 25
26 // BookmarkBubbleView is a view intended to be used as the content of an 26 // BookmarkBubbleView is a view intended to be used as the content of an
27 // InfoBubble. BookmarkBubbleView provides views for unstarring and editting 27 // InfoBubble. BookmarkBubbleView provides views for unstarring and editting
28 // the bookmark it is created with. Don't create a BookmarkBubbleView directly, 28 // the bookmark it is created with. Don't create a BookmarkBubbleView directly,
29 // instead use the static Show method. 29 // instead use the static Show method.
30 class BookmarkBubbleView : public views::View, 30 class BookmarkBubbleView : public views::View,
31 public views::LinkController, 31 public views::LinkController,
32 public views::ButtonListener, 32 public views::ButtonListener,
33 public views::ComboBox::Listener, 33 public views::Combobox::Listener,
34 public InfoBubbleDelegate { 34 public InfoBubbleDelegate {
35 public: 35 public:
36 static void Show(views::Window* window, 36 static void Show(views::Window* window,
37 const gfx::Rect& bounds, 37 const gfx::Rect& bounds,
38 InfoBubbleDelegate* delegate, 38 InfoBubbleDelegate* delegate,
39 Profile* profile, 39 Profile* profile,
40 const GURL& url, 40 const GURL& url,
41 bool newly_bookmarked); 41 bool newly_bookmarked);
42 42
43 static bool IsShowing(); 43 static bool IsShowing();
44 44
45 static void Hide(); 45 static void Hide();
46 46
47 virtual ~BookmarkBubbleView(); 47 virtual ~BookmarkBubbleView();
48 48
49 // Overriden to force a layout. 49 // Overriden to force a layout.
50 virtual void DidChangeBounds(const gfx::Rect& previous, 50 virtual void DidChangeBounds(const gfx::Rect& previous,
51 const gfx::Rect& current); 51 const gfx::Rect& current);
52 52
53 // Invoked after the bubble has been shown. 53 // Invoked after the bubble has been shown.
54 virtual void BubbleShown(); 54 virtual void BubbleShown();
55 55
56 // Override to close on return. 56 // Override to close on return.
57 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); 57 virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
58 58
59 private: 59 private:
60 // Model for the combobox showing the list of folders to choose from. The 60 // Model for the combobox showing the list of folders to choose from. The
61 // list always contains the bookmark bar, other node and parent. The list 61 // list always contains the bookmark bar, other node and parent. The list
62 // also contains an extra item that shows the text 'Choose another folder...'. 62 // also contains an extra item that shows the text 'Choose another folder...'.
63 class RecentlyUsedFoldersModel : public views::ComboBox::Model { 63 class RecentlyUsedFoldersModel : public views::Combobox::Model {
64 public: 64 public:
65 RecentlyUsedFoldersModel(BookmarkModel* bb_model, BookmarkNode* node); 65 RecentlyUsedFoldersModel(BookmarkModel* bb_model, BookmarkNode* node);
66 66
67 // ComboBox::Model methods. Call through to nodes_. 67 // Combobox::Model methods. Call through to nodes_.
68 virtual int GetItemCount(views::ComboBox* source); 68 virtual int GetItemCount(views::Combobox* source);
69 virtual std::wstring GetItemAt(views::ComboBox* source, int index); 69 virtual std::wstring GetItemAt(views::Combobox* source, int index);
70 70
71 // Returns the node at the specified index. 71 // Returns the node at the specified index.
72 BookmarkNode* GetNodeAt(int index); 72 BookmarkNode* GetNodeAt(int index);
73 73
74 // Returns the index of the original parent folder. 74 // Returns the index of the original parent folder.
75 int node_parent_index() const { return node_parent_index_; } 75 int node_parent_index() const { return node_parent_index_; }
76 76
77 private: 77 private:
78 // Removes node from nodes_. Does nothing if node is not in nodes_. 78 // Removes node from nodes_. Does nothing if node is not in nodes_.
79 void RemoveNode(BookmarkNode* node); 79 void RemoveNode(BookmarkNode* node);
(...skipping 17 matching lines...) Expand all
97 // Returns the title to display. 97 // Returns the title to display.
98 std::wstring GetTitle(); 98 std::wstring GetTitle();
99 99
100 // LinkController method, either unstars the item or shows the bookmark 100 // LinkController method, either unstars the item or shows the bookmark
101 // editor (depending upon which link was clicked). 101 // editor (depending upon which link was clicked).
102 virtual void LinkActivated(views::Link* source, int event_flags); 102 virtual void LinkActivated(views::Link* source, int event_flags);
103 103
104 // ButtonListener method, closes the bubble or opens the edit dialog. 104 // ButtonListener method, closes the bubble or opens the edit dialog.
105 virtual void ButtonPressed(views::Button* sender); 105 virtual void ButtonPressed(views::Button* sender);
106 106
107 // ComboBox::Listener method. Changes the parent of the bookmark. 107 // Combobox::Listener method. Changes the parent of the bookmark.
108 virtual void ItemChanged(views::ComboBox* combo_box, 108 virtual void ItemChanged(views::Combobox* combobox,
109 int prev_index, 109 int prev_index,
110 int new_index); 110 int new_index);
111 111
112 // InfoBubbleDelegate methods. These forward to the InfoBubbleDelegate 112 // InfoBubbleDelegate methods. These forward to the InfoBubbleDelegate
113 // supplied in the constructor as well as sending out the necessary 113 // supplied in the constructor as well as sending out the necessary
114 // notification. 114 // notification.
115 virtual void InfoBubbleClosing(InfoBubble* info_bubble, 115 virtual void InfoBubbleClosing(InfoBubble* info_bubble,
116 bool closed_by_escape); 116 bool closed_by_escape);
117 virtual bool CloseOnEscape(); 117 virtual bool CloseOnEscape();
118 118
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // Button to bring up the editor. 152 // Button to bring up the editor.
153 views::NativeButton* edit_button_; 153 views::NativeButton* edit_button_;
154 154
155 // Button to close the window. 155 // Button to close the window.
156 views::NativeButton* close_button_; 156 views::NativeButton* close_button_;
157 157
158 // Textfield showing the title of the bookmark. 158 // Textfield showing the title of the bookmark.
159 views::Textfield* title_tf_; 159 views::Textfield* title_tf_;
160 160
161 // ComboBox showing a handful of folders the user can choose from, including 161 // Combobox showing a handful of folders the user can choose from, including
162 // the current parent. 162 // the current parent.
163 views::ComboBox* parent_combobox_; 163 views::Combobox* parent_combobox_;
164 164
165 // When the destructor is invoked should the bookmark be removed? 165 // When the destructor is invoked should the bookmark be removed?
166 bool remove_bookmark_; 166 bool remove_bookmark_;
167 167
168 // When the destructor is invoked should edits be applied? 168 // When the destructor is invoked should edits be applied?
169 bool apply_edits_; 169 bool apply_edits_;
170 170
171 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView); 171 DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleView);
172 }; 172 };
173 173
174 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_ 174 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/bookmark_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698