| OLD | NEW |
| 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_FRAME_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Returns a pointer to the BrowserView* interface implementation (an | 97 // Returns a pointer to the BrowserView* interface implementation (an |
| 98 // instance of this object, typically) for a given native window, or NULL if | 98 // instance of this object, typically) for a given native window, or NULL if |
| 99 // there is no such association. | 99 // there is no such association. |
| 100 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window); | 100 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window); |
| 101 | 101 |
| 102 // Returns a Browser instance of this view. | 102 // Returns a Browser instance of this view. |
| 103 Browser* browser() const { return browser_.get(); } | 103 Browser* browser() const { return browser_.get(); } |
| 104 | 104 |
| 105 // Called by the frame to notify the BrowserView that it was moved, and that | 105 // Called by the frame to notify the BrowserView that it was moved, and that |
| 106 // any dependent popup windows should be repositioned. | 106 // any dependent popup windows should be repositioned. |
| 107 void WindowMoved(); | 107 virtual void WindowMoved(); |
| 108 | 108 |
| 109 // Called by the frame to notify the BrowserView that a move or resize was | 109 // Called by the frame to notify the BrowserView that a move or resize was |
| 110 // initiated. | 110 // initiated. |
| 111 void WindowMoveOrResizeStarted(); | 111 virtual void WindowMoveOrResizeStarted(); |
| 112 | 112 |
| 113 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. | 113 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. |
| 114 // These differ from |toolbar_.bounds()| in that they match where the toolbar | 114 // These differ from |toolbar_.bounds()| in that they match where the toolbar |
| 115 // background image is drawn -- slightly outside the "true" bounds | 115 // background image is drawn -- slightly outside the "true" bounds |
| 116 // horizontally, and, when using vertical tabs, behind the tab column. | 116 // horizontally, and, when using vertical tabs, behind the tab column. |
| 117 gfx::Rect GetToolbarBounds() const; | 117 virtual gfx::Rect GetToolbarBounds() const; |
| 118 | 118 |
| 119 // Returns the bounds of the content area, in the coordinates of the | 119 // Returns the bounds of the content area, in the coordinates of the |
| 120 // BrowserView's parent. | 120 // BrowserView's parent. |
| 121 gfx::Rect GetClientAreaBounds() const; | 121 gfx::Rect GetClientAreaBounds() const; |
| 122 | 122 |
| 123 // Returns the constraining bounding box that should be used to lay out the | 123 // Returns the constraining bounding box that should be used to lay out the |
| 124 // FindBar within. This is _not_ the size of the find bar, just the bounding | 124 // FindBar within. This is _not_ the size of the find bar, just the bounding |
| 125 // box it should be laid out within. The coordinate system of the returned | 125 // box it should be laid out within. The coordinate system of the returned |
| 126 // rect is in the coordinate system of the frame, since the FindBar is a child | 126 // rect is in the coordinate system of the frame, since the FindBar is a child |
| 127 // window. | 127 // window. |
| 128 gfx::Rect GetFindBarBoundingBox() const; | 128 gfx::Rect GetFindBarBoundingBox() const; |
| 129 | 129 |
| 130 // Returns the preferred height of the TabStrip. Used to position the OTR | 130 // Returns the preferred height of the TabStrip. Used to position the OTR |
| 131 // avatar icon. | 131 // avatar icon. |
| 132 int GetTabStripHeight() const; | 132 virtual int GetTabStripHeight() const; |
| 133 | 133 |
| 134 // Takes some view's origin (relative to this BrowserView) and offsets it such | 134 // Takes some view's origin (relative to this BrowserView) and offsets it such |
| 135 // that it can be used as the source origin for seamlessly tiling the toolbar | 135 // that it can be used as the source origin for seamlessly tiling the toolbar |
| 136 // background image over that view. | 136 // background image over that view. |
| 137 gfx::Point OffsetPointForToolbarBackgroundImage( | 137 gfx::Point OffsetPointForToolbarBackgroundImage( |
| 138 const gfx::Point& point) const; | 138 const gfx::Point& point) const; |
| 139 | 139 |
| 140 // Returns the width of the currently displayed sidebar or 0. | 140 // Returns the width of the currently displayed sidebar or 0. |
| 141 int GetSidebarWidth() const; | 141 int GetSidebarWidth() const; |
| 142 | 142 |
| 143 // Accessor for the TabStrip. | 143 // Accessor for the TabStrip. |
| 144 AbstractTabStripView* tabstrip() const { return tabstrip_; } | 144 AbstractTabStripView* tabstrip() const { return tabstrip_; } |
| 145 | 145 |
| 146 // Accessor for the Toolbar. | 146 // Accessor for the Toolbar. |
| 147 ToolbarView* toolbar() const { return toolbar_; } | 147 ToolbarView* toolbar() const { return toolbar_; } |
| 148 | 148 |
| 149 // Returns true if various window components are visible. | 149 // Returns true if various window components are visible. |
| 150 bool IsTabStripVisible() const; | 150 virtual bool IsTabStripVisible() const; |
| 151 | 151 |
| 152 // Returns true if the vertical tabstrip is in use. | 152 // Returns true if the vertical tabstrip is in use. |
| 153 bool UseVerticalTabs() const; | 153 bool UseVerticalTabs() const; |
| 154 | 154 |
| 155 // Returns true if the profile associated with this Browser window is | 155 // Returns true if the profile associated with this Browser window is |
| 156 // incognito. | 156 // incognito. |
| 157 bool IsOffTheRecord() const; | 157 bool IsOffTheRecord() const; |
| 158 | 158 |
| 159 // Returns true if the non-client view should render the Off-The-Record | 159 // Returns true if the non-client view should render the Off-The-Record |
| 160 // avatar icon if the window is incognito. | 160 // avatar icon if the window is incognito. |
| 161 bool ShouldShowOffTheRecordAvatar() const; | 161 virtual bool ShouldShowOffTheRecordAvatar() const; |
| 162 | 162 |
| 163 // Handle the specified |accelerator| being pressed. | 163 // Handle the specified |accelerator| being pressed. |
| 164 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 164 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| 165 | 165 |
| 166 // Provides the containing frame with the accelerator for the specified | 166 // Provides the containing frame with the accelerator for the specified |
| 167 // command id. This can be used to provide menu item shortcut hints etc. | 167 // command id. This can be used to provide menu item shortcut hints etc. |
| 168 // Returns true if an accelerator was found for the specified |cmd_id|, false | 168 // Returns true if an accelerator was found for the specified |cmd_id|, false |
| 169 // otherwise. | 169 // otherwise. |
| 170 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); | 170 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); |
| 171 | 171 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 virtual void Layout() OVERRIDE; | 404 virtual void Layout() OVERRIDE; |
| 405 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 405 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 406 virtual void ViewHierarchyChanged(bool is_add, | 406 virtual void ViewHierarchyChanged(bool is_add, |
| 407 views::View* parent, | 407 views::View* parent, |
| 408 views::View* child) OVERRIDE; | 408 views::View* child) OVERRIDE; |
| 409 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 409 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 410 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 410 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 411 | 411 |
| 412 // Factory Methods. | 412 // Factory Methods. |
| 413 // Returns a new LayoutManager for this browser view. A subclass may | 413 // Returns a new LayoutManager for this browser view. A subclass may |
| 414 // override to implemnet different layout pocily. | 414 // override to implement different layout potentially. |
| 415 virtual views::LayoutManager* CreateLayoutManager() const; | 415 virtual views::LayoutManager* CreateLayoutManager() const; |
| 416 | 416 |
| 417 // Initializes a new TabStrip for the browser view. This can be performed | 417 // Initializes a new TabStrip for the browser view. This can be performed |
| 418 // multiple times over the life of the browser, and is run when the display | 418 // multiple times over the life of the browser, and is run when the display |
| 419 // mode for the tabstrip changes from horizontal to vertical. | 419 // mode for the tabstrip changes from horizontal to vertical. |
| 420 virtual void InitTabStrip(TabStripModel* tab_strip_model); | 420 virtual void InitTabStrip(TabStripModel* tab_strip_model); |
| 421 | 421 |
| 422 // Factory Methods. |
| 423 // Returns a new ToolbarView for this browser view. A subclass may |
| 424 // override to implement different layout potentially. |
| 425 virtual ToolbarView* CreateToolbar() const; |
| 426 |
| 422 // Browser window related initializations. | 427 // Browser window related initializations. |
| 423 virtual void Init(); | 428 virtual void Init(); |
| 424 | 429 |
| 430 // Callback for the loading animation(s) associated with this view. |
| 431 virtual void LoadingAnimationCallback(); |
| 432 |
| 425 private: | 433 private: |
| 426 friend class BrowserViewLayout; | 434 friend class BrowserViewLayout; |
| 427 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, | 435 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, |
| 428 TestAboutChromeViewAccObj); | 436 TestAboutChromeViewAccObj); |
| 429 | 437 |
| 430 #if defined(OS_WIN) | 438 #if defined(OS_WIN) |
| 431 // Creates the system menu. | 439 // Creates the system menu. |
| 432 void InitSystemMenu(); | 440 void InitSystemMenu(); |
| 433 #endif | 441 #endif |
| 434 | 442 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 498 |
| 491 #if defined(OS_WIN) | 499 #if defined(OS_WIN) |
| 492 // Builds the correct menu for when we have minimal chrome. | 500 // Builds the correct menu for when we have minimal chrome. |
| 493 void BuildSystemMenuForBrowserWindow(); | 501 void BuildSystemMenuForBrowserWindow(); |
| 494 void BuildSystemMenuForAppOrPopupWindow(bool is_app); | 502 void BuildSystemMenuForAppOrPopupWindow(bool is_app); |
| 495 #endif | 503 #endif |
| 496 | 504 |
| 497 // Retrieves the command id for the specified Windows app command. | 505 // Retrieves the command id for the specified Windows app command. |
| 498 int GetCommandIDForAppCommandID(int app_command_id) const; | 506 int GetCommandIDForAppCommandID(int app_command_id) const; |
| 499 | 507 |
| 500 // Callback for the loading animation(s) associated with this view. | |
| 501 void LoadingAnimationCallback(); | |
| 502 | |
| 503 // Initialize the hung plugin detector. | 508 // Initialize the hung plugin detector. |
| 504 void InitHangMonitor(); | 509 void InitHangMonitor(); |
| 505 | 510 |
| 506 // Possibly records a user metrics action corresponding to the passed-in | 511 // Possibly records a user metrics action corresponding to the passed-in |
| 507 // accelerator. Only implemented for Chrome OS, where we're interested in | 512 // accelerator. Only implemented for Chrome OS, where we're interested in |
| 508 // learning about how frequently the top-row keys are used. | 513 // learning about how frequently the top-row keys are used. |
| 509 void UpdateAcceleratorMetrics(const views::Accelerator& accelerator, | 514 void UpdateAcceleratorMetrics(const views::Accelerator& accelerator, |
| 510 int command_id); | 515 int command_id); |
| 511 | 516 |
| 512 // Invoked from TabSelectedAt or when instant is made active. Is | 517 // Invoked from TabSelectedAt or when instant is made active. Is |
| 513 // |change_tab_contents| is true, |new_contents| is added to the view | 518 // |change_tab_contents| is true, |new_contents| is added to the view |
| 514 // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents| | 519 // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents| |
| 515 // has already been added to the view hierarchy. | 520 // has already been added to the view hierarchy. |
| 516 void ProcessTabSelected(TabContentsWrapper* new_contents, | 521 void ProcessTabSelected(TabContentsWrapper* new_contents, |
| 517 bool change_tab_contents); | 522 bool change_tab_contents); |
| 518 | 523 |
| 519 // Exposes resize corner size to BrowserViewLayout. | 524 // Exposes resize corner size to BrowserViewLayout. |
| 520 gfx::Size GetResizeCornerSize() const; | 525 gfx::Size GetResizeCornerSize() const; |
| 521 | 526 |
| 522 // Shows the about chrome modal dialog and returns the Window object. | 527 // Shows the about chrome modal dialog and returns the Window object. |
| 523 views::Window* DoShowAboutChromeDialog(); | 528 views::Window* DoShowAboutChromeDialog(); |
| 524 | 529 |
| 530 // Set the value of |toolbar_| and hook it into the views hiearchy |
| 531 void SetToolbar(ToolbarView* toolbar); |
| 532 |
| 525 // Last focused view that issued a tab traversal. | 533 // Last focused view that issued a tab traversal. |
| 526 int last_focused_view_storage_id_; | 534 int last_focused_view_storage_id_; |
| 527 | 535 |
| 528 // The BrowserFrame that hosts this view. | 536 // The BrowserFrame that hosts this view. |
| 529 BrowserFrame* frame_; | 537 BrowserFrame* frame_; |
| 530 | 538 |
| 531 // The Browser object we are associated with. | 539 // The Browser object we are associated with. |
| 532 scoped_ptr<Browser> browser_; | 540 scoped_ptr<Browser> browser_; |
| 533 | 541 |
| 534 // BrowserView layout (LTR one is pictured here). | 542 // BrowserView layout (LTR one is pictured here). |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 676 |
| 669 NotificationRegistrar registrar_; | 677 NotificationRegistrar registrar_; |
| 670 | 678 |
| 671 // Used to measure the loading spinner animation rate. | 679 // Used to measure the loading spinner animation rate. |
| 672 base::TimeTicks last_animation_time_; | 680 base::TimeTicks last_animation_time_; |
| 673 | 681 |
| 674 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 682 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 675 }; | 683 }; |
| 676 | 684 |
| 677 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 685 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |