OLD | NEW |
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_TOOLBAR_VIEW_H__ | 5 #ifndef CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ |
6 #define CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ | 6 #define CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "base/ref_counted.h" |
10 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
11 #include "chrome/browser/back_forward_menu_model.h" | 12 #include "chrome/browser/back_forward_menu_model.h" |
12 #include "chrome/browser/controller.h" | 13 #include "chrome/browser/controller.h" |
13 #include "chrome/browser/encoding_menu_controller_delegate.h" | 14 #include "chrome/browser/encoding_menu_controller_delegate.h" |
| 15 #include "chrome/browser/user_data_manager.h" |
14 #include "chrome/browser/views/dom_view.h" | 16 #include "chrome/browser/views/dom_view.h" |
15 #include "chrome/browser/views/go_button.h" | 17 #include "chrome/browser/views/go_button.h" |
16 #include "chrome/browser/views/location_bar_view.h" | 18 #include "chrome/browser/views/location_bar_view.h" |
17 #include "chrome/common/pref_member.h" | 19 #include "chrome/common/pref_member.h" |
18 #include "chrome/views/menu.h" | 20 #include "chrome/views/menu.h" |
19 #include "chrome/views/menu_button.h" | 21 #include "chrome/views/menu_button.h" |
20 #include "chrome/views/view.h" | 22 #include "chrome/views/view.h" |
21 #include "chrome/views/view_menu_delegate.h" | 23 #include "chrome/views/view_menu_delegate.h" |
22 | 24 |
23 class Browser; | 25 class Browser; |
24 class Profile; | 26 class Profile; |
25 class ToolbarStarToggle; | 27 class ToolbarStarToggle; |
26 | 28 |
27 /////////////////////////////////////////////////////////////////////////////// | 29 /////////////////////////////////////////////////////////////////////////////// |
28 // | 30 // |
29 // BrowserToolbarView class | 31 // BrowserToolbarView class |
30 // | 32 // |
31 // The BrowserToolbarView is responsible for constructing the content of and | 33 // The BrowserToolbarView is responsible for constructing the content of and |
32 // rendering the Toolbar used in the Browser Window | 34 // rendering the Toolbar used in the Browser Window |
33 // | 35 // |
34 /////////////////////////////////////////////////////////////////////////////// | 36 /////////////////////////////////////////////////////////////////////////////// |
35 class BrowserToolbarView : public views::View, | 37 class BrowserToolbarView : public views::View, |
36 public EncodingMenuControllerDelegate, | 38 public EncodingMenuControllerDelegate, |
37 public views::ViewMenuDelegate, | 39 public views::ViewMenuDelegate, |
38 public views::DragController, | 40 public views::DragController, |
39 public LocationBarView::Delegate, | 41 public LocationBarView::Delegate, |
40 public NotificationObserver { | 42 public NotificationObserver, |
| 43 public GetProfilesHelper::Delegate { |
41 public: | 44 public: |
42 BrowserToolbarView(CommandController* controller, Browser* browser); | 45 BrowserToolbarView(CommandController* controller, Browser* browser); |
43 virtual ~BrowserToolbarView(); | 46 virtual ~BrowserToolbarView(); |
44 | 47 |
45 // Create the contents of the Browser Toolbar | 48 // Create the contents of the Browser Toolbar |
46 void Init(Profile* profile); | 49 void Init(Profile* profile); |
47 | 50 |
48 // views::View | 51 // views::View |
49 virtual void Layout(); | 52 virtual void Layout(); |
50 virtual void DidGainFocus(); | 53 virtual void DidGainFocus(); |
51 virtual void WillLoseFocus(); | 54 virtual void WillLoseFocus(); |
52 virtual bool OnKeyPressed(const views::KeyEvent& e); | 55 virtual bool OnKeyPressed(const views::KeyEvent& e); |
53 virtual bool OnKeyReleased(const views::KeyEvent& e); | 56 virtual bool OnKeyReleased(const views::KeyEvent& e); |
54 virtual gfx::Size GetPreferredSize(); | 57 virtual gfx::Size GetPreferredSize(); |
55 | 58 |
56 // Overridden from EncodingMenuControllerDelegate: | 59 // Overridden from EncodingMenuControllerDelegate: |
57 virtual bool IsItemChecked(int id) const; | 60 virtual bool IsItemChecked(int id) const; |
58 | 61 |
59 // Overridden from Menu::BaseControllerDelegate: | 62 // Overridden from Menu::BaseControllerDelegate: |
| 63 virtual void ExecuteCommand(int id); |
60 virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); | 64 virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); |
61 | 65 |
62 // views::MenuDelegate | 66 // views::MenuDelegate |
63 virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); | 67 virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); |
64 | 68 |
| 69 // GetProfilesHelper::Delegate method. |
| 70 virtual void OnGetProfilesDone(const std::vector<std::wstring>& profiles); |
| 71 |
65 // Sets the profile which is active on the currently-active tab. | 72 // Sets the profile which is active on the currently-active tab. |
66 void SetProfile(Profile* profile); | 73 void SetProfile(Profile* profile); |
67 Profile* profile() { return profile_; } | 74 Profile* profile() { return profile_; } |
68 | 75 |
69 ToolbarStarToggle* star_button() { return star_; } | 76 ToolbarStarToggle* star_button() { return star_; } |
70 | 77 |
71 GoButton* GetGoButton() { return go_; } | 78 GoButton* GetGoButton() { return go_; } |
72 | 79 |
73 LocationBarView* GetLocationBarView() const { return location_bar_; } | 80 LocationBarView* GetLocationBarView() const { return location_bar_; } |
74 | 81 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 LocationBarView* location_bar_; | 180 LocationBarView* location_bar_; |
174 GoButton* go_; | 181 GoButton* go_; |
175 views::MenuButton* page_menu_; | 182 views::MenuButton* page_menu_; |
176 views::MenuButton* app_menu_; | 183 views::MenuButton* app_menu_; |
177 Profile* profile_; | 184 Profile* profile_; |
178 Browser* browser_; | 185 Browser* browser_; |
179 | 186 |
180 // Current tab we're showing state for. | 187 // Current tab we're showing state for. |
181 TabContents* tab_; | 188 TabContents* tab_; |
182 | 189 |
| 190 // Profiles menu to populate with profile names. |
| 191 Menu* profiles_menu_; |
| 192 |
| 193 // Helper class to enumerate profiles information on the file thread. |
| 194 scoped_refptr<GetProfilesHelper> profiles_helper_; |
| 195 |
183 // Controls whether or not a home button should be shown on the toolbar. | 196 // Controls whether or not a home button should be shown on the toolbar. |
184 BooleanPrefMember show_home_button_; | 197 BooleanPrefMember show_home_button_; |
185 | 198 |
186 // The display mode used when laying out the toolbar. | 199 // The display mode used when laying out the toolbar. |
187 DisplayMode display_mode_; | 200 DisplayMode display_mode_; |
188 }; | 201 }; |
189 | 202 |
190 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ | 203 #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ |
191 | |
OLD | NEW |