OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_FRAME_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/menus/simple_menu_model.h" | 13 #include "app/menus/simple_menu_model.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/timer.h" | 15 #include "base/timer.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "chrome/browser/browser.h" | 17 #include "chrome/browser/browser.h" |
18 #include "chrome/browser/browser_window.h" | 18 #include "chrome/browser/browser_window.h" |
19 #include "chrome/browser/extensions/image_loading_tracker.h" | |
20 #include "chrome/browser/tabs/tab_strip_model.h" | 19 #include "chrome/browser/tabs/tab_strip_model.h" |
21 #include "chrome/browser/views/frame/browser_bubble_host.h" | 20 #include "chrome/browser/views/frame/browser_bubble_host.h" |
22 #include "chrome/browser/views/frame/browser_frame.h" | 21 #include "chrome/browser/views/frame/browser_frame.h" |
23 #include "chrome/browser/views/infobars/infobar_container.h" | 22 #include "chrome/browser/views/infobars/infobar_container.h" |
24 #include "chrome/browser/views/tabs/tab_strip.h" | 23 #include "chrome/browser/views/tabs/tab_strip.h" |
25 #include "chrome/browser/views/tabs/base_tab_strip.h" | 24 #include "chrome/browser/views/tabs/base_tab_strip.h" |
26 #include "chrome/browser/views/unhandled_keyboard_event_handler.h" | 25 #include "chrome/browser/views/unhandled_keyboard_event_handler.h" |
27 #include "gfx/native_widget_types.h" | 26 #include "gfx/native_widget_types.h" |
28 #include "views/controls/image_view.h" | |
29 #include "views/controls/label.h" | |
30 #include "views/window/client_view.h" | 27 #include "views/window/client_view.h" |
31 #include "views/window/window_delegate.h" | 28 #include "views/window/window_delegate.h" |
32 | 29 |
33 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
34 #include "chrome/browser/hang_monitor/hung_plugin_action.h" | 31 #include "chrome/browser/hang_monitor/hung_plugin_action.h" |
35 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 32 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
36 #include "views/controls/menu/native_menu_win.h" | 33 #include "views/controls/menu/native_menu_win.h" |
37 #endif | 34 #endif |
38 | 35 |
39 // NOTE: For more information about the objects and files in this directory, | 36 // NOTE: For more information about the objects and files in this directory, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // including the TabStrip, toolbars, download shelves, the content area etc. | 73 // including the TabStrip, toolbars, download shelves, the content area etc. |
77 // | 74 // |
78 class BrowserView : public BrowserBubbleHost, | 75 class BrowserView : public BrowserBubbleHost, |
79 public BrowserWindow, | 76 public BrowserWindow, |
80 public BrowserWindowTesting, | 77 public BrowserWindowTesting, |
81 public NotificationObserver, | 78 public NotificationObserver, |
82 public TabStripModelObserver, | 79 public TabStripModelObserver, |
83 public menus::SimpleMenuModel::Delegate, | 80 public menus::SimpleMenuModel::Delegate, |
84 public views::WindowDelegate, | 81 public views::WindowDelegate, |
85 public views::ClientView, | 82 public views::ClientView, |
86 public InfoBarContainer::Delegate, | 83 public InfoBarContainer::Delegate { |
87 public ImageLoadingTracker::Observer { | |
88 public: | 84 public: |
89 // The browser view's class name. | 85 // The browser view's class name. |
90 static const char kViewClassName[]; | 86 static const char kViewClassName[]; |
91 | 87 |
92 // Explicitly sets how windows are shown. Use a value of -1 to give the | 88 // Explicitly sets how windows are shown. Use a value of -1 to give the |
93 // default behavior. This is used during testing and not generally useful | 89 // default behavior. This is used during testing and not generally useful |
94 // otherwise. | 90 // otherwise. |
95 static void SetShowState(int state); | 91 static void SetShowState(int state); |
96 | 92 |
97 explicit BrowserView(Browser* browser); | 93 explicit BrowserView(Browser* browser); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 gfx::Rect GetFindBarBoundingBox() const; | 137 gfx::Rect GetFindBarBoundingBox() const; |
142 | 138 |
143 // Returns the preferred height of the TabStrip. Used to position the OTR | 139 // Returns the preferred height of the TabStrip. Used to position the OTR |
144 // avatar icon. | 140 // avatar icon. |
145 int GetTabStripHeight() const; | 141 int GetTabStripHeight() const; |
146 | 142 |
147 // Returns the bounds of the TabStrip. Used by themed views to determine the | 143 // Returns the bounds of the TabStrip. Used by themed views to determine the |
148 // offset of IDR_THEME_TOOLBAR. | 144 // offset of IDR_THEME_TOOLBAR. |
149 gfx::Rect GetTabStripBounds() const; | 145 gfx::Rect GetTabStripBounds() const; |
150 | 146 |
151 // Accessor for the big icon used with TYPE_EXTENSION_APP, or NULL if this | |
152 // browser isn't TYPE_EXTENSION_APP. | |
153 views::ImageView* extension_app_icon() const { return extension_app_icon_; } | |
154 | |
155 // Accessor for the big title used with TYPE_EXTENSION_APP, or NULL if this | |
156 // browser isn't TYPE_EXTENSION_APP. | |
157 views::Label* extension_app_title() const { return extension_app_title_; } | |
158 | |
159 // Accessor for the TabStrip. | 147 // Accessor for the TabStrip. |
160 BaseTabStrip* tabstrip() const { return tabstrip_; } | 148 BaseTabStrip* tabstrip() const { return tabstrip_; } |
161 | 149 |
162 // Accessor for the Toolbar. | 150 // Accessor for the Toolbar. |
163 ToolbarView* toolbar() const { return toolbar_; } | 151 ToolbarView* toolbar() const { return toolbar_; } |
164 | 152 |
165 // Accessor for the ExtensionShelf. | 153 // Accessor for the ExtensionShelf. |
166 ExtensionShelf* extension_shelf() const { return extension_shelf_; } | 154 ExtensionShelf* extension_shelf() const { return extension_shelf_; } |
167 | 155 |
168 // Returns true if various window components are visible. | 156 // Returns true if various window components are visible. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // used on Linux. | 230 // used on Linux. |
243 void FullScreenStateChanged(); | 231 void FullScreenStateChanged(); |
244 | 232 |
245 // Restores the focused view. This is also used to set the initial focus | 233 // Restores the focused view. This is also used to set the initial focus |
246 // when a new browser window is created. | 234 // when a new browser window is created. |
247 void RestoreFocus(); | 235 void RestoreFocus(); |
248 | 236 |
249 // Called when the activation of the frame changes. | 237 // Called when the activation of the frame changes. |
250 virtual void ActivationChanged(bool activated); | 238 virtual void ActivationChanged(bool activated); |
251 | 239 |
252 // Overriden from ImageLoadingTracker::Observer. | |
253 virtual void OnImageLoaded(SkBitmap* image, ExtensionResource resource, | |
254 int index); | |
255 | |
256 // Overridden from BrowserWindow: | 240 // Overridden from BrowserWindow: |
257 virtual void Show(); | 241 virtual void Show(); |
258 virtual void SetBounds(const gfx::Rect& bounds); | 242 virtual void SetBounds(const gfx::Rect& bounds); |
259 virtual void Close(); | 243 virtual void Close(); |
260 virtual void Activate(); | 244 virtual void Activate(); |
261 virtual bool IsActive() const; | 245 virtual bool IsActive() const; |
262 virtual void FlashFrame(); | 246 virtual void FlashFrame(); |
263 virtual gfx::NativeWindow GetNativeHandle(); | 247 virtual gfx::NativeWindow GetNativeHandle(); |
264 virtual BrowserWindowTesting* GetBrowserWindowTesting(); | 248 virtual BrowserWindowTesting* GetBrowserWindowTesting(); |
265 virtual StatusBubble* GetStatusBubble(); | 249 virtual StatusBubble* GetStatusBubble(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 bool show_history); | 308 bool show_history); |
325 virtual void ShowAppMenu(); | 309 virtual void ShowAppMenu(); |
326 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 310 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
327 bool* is_keyboard_shortcut); | 311 bool* is_keyboard_shortcut); |
328 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); | 312 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
329 virtual void ShowCreateShortcutsDialog(TabContents* tab_contents); | 313 virtual void ShowCreateShortcutsDialog(TabContents* tab_contents); |
330 virtual void Cut(); | 314 virtual void Cut(); |
331 virtual void Copy(); | 315 virtual void Copy(); |
332 virtual void Paste(); | 316 virtual void Paste(); |
333 virtual void ToggleTabStripMode(); | 317 virtual void ToggleTabStripMode(); |
334 virtual void SetToolbarCollapsedMode(bool val); | |
335 | 318 |
336 // Overridden from BrowserWindowTesting: | 319 // Overridden from BrowserWindowTesting: |
337 virtual BookmarkBarView* GetBookmarkBarView() const; | 320 virtual BookmarkBarView* GetBookmarkBarView() const; |
338 virtual LocationBarView* GetLocationBarView() const; | 321 virtual LocationBarView* GetLocationBarView() const; |
339 virtual views::View* GetTabContentsContainerView() const; | 322 virtual views::View* GetTabContentsContainerView() const; |
340 virtual ToolbarView* GetToolbarView() const; | 323 virtual ToolbarView* GetToolbarView() const; |
341 | 324 |
342 // Overridden from NotificationObserver: | 325 // Overridden from NotificationObserver: |
343 virtual void Observe(NotificationType type, | 326 virtual void Observe(NotificationType type, |
344 const NotificationSource& source, | 327 const NotificationSource& source, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 BrowserFrame* frame_; | 486 BrowserFrame* frame_; |
504 | 487 |
505 // The Browser object we are associated with. | 488 // The Browser object we are associated with. |
506 scoped_ptr<Browser> browser_; | 489 scoped_ptr<Browser> browser_; |
507 | 490 |
508 // Tool/Info bars that we are currently showing. Used for layout. | 491 // Tool/Info bars that we are currently showing. Used for layout. |
509 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing, | 492 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing, |
510 // or is bookmark_bar_view_ if the bookmark bar is showing. | 493 // or is bookmark_bar_view_ if the bookmark bar is showing. |
511 views::View* active_bookmark_bar_; | 494 views::View* active_bookmark_bar_; |
512 | 495 |
513 // The big icon in the top-left if this browser is TYPE_EXTENSION_APP, or | |
514 // NULL otherwise. | |
515 views::ImageView* extension_app_icon_; | |
516 | |
517 // The big title text in the top-left if this browser is TYPE_EXTENSION_APP, | |
518 // or NULL otherwise. | |
519 views::Label* extension_app_title_; | |
520 | |
521 // The TabStrip. | 496 // The TabStrip. |
522 BaseTabStrip* tabstrip_; | 497 BaseTabStrip* tabstrip_; |
523 | 498 |
524 // The Toolbar containing the navigation buttons, menus and the address bar. | 499 // The Toolbar containing the navigation buttons, menus and the address bar. |
525 ToolbarView* toolbar_; | 500 ToolbarView* toolbar_; |
526 | 501 |
527 // The Bookmark Bar View for this window. Lazily created. | 502 // The Bookmark Bar View for this window. Lazily created. |
528 scoped_ptr<BookmarkBarView> bookmark_bar_view_; | 503 scoped_ptr<BookmarkBarView> bookmark_bar_view_; |
529 | 504 |
530 // The download shelf view (view at the bottom of the page). | 505 // The download shelf view (view at the bottom of the page). |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 // The timer used to update frames for the Loading Animation. | 568 // The timer used to update frames for the Loading Animation. |
594 base::RepeatingTimer<BrowserView> loading_animation_timer_; | 569 base::RepeatingTimer<BrowserView> loading_animation_timer_; |
595 | 570 |
596 // A bottom bar for showing extensions. | 571 // A bottom bar for showing extensions. |
597 ExtensionShelf* extension_shelf_; | 572 ExtensionShelf* extension_shelf_; |
598 | 573 |
599 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 574 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
600 | 575 |
601 scoped_ptr<AccessibleViewHelper> accessible_view_helper_; | 576 scoped_ptr<AccessibleViewHelper> accessible_view_helper_; |
602 | 577 |
603 // Loads extension_app_icon_ asynchronously on the file thread. | |
604 ImageLoadingTracker extension_app_icon_loader_; | |
605 | |
606 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 578 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
607 }; | 579 }; |
608 | 580 |
609 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ | 581 #endif // CHROME_BROWSER_VIEWS_FRAME_BROWSER_VIEW_H_ |
OLD | NEW |