| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 63 class AeroPeekManager; | 63 class AeroPeekManager; |
| 64 class JumpList; | 64 class JumpList; |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 namespace views { | 67 namespace views { |
| 68 class ExternalFocusTracker; | 68 class ExternalFocusTracker; |
| 69 class Menu; | 69 class Menu; |
| 70 } | 70 } |
| 71 | 71 |
| 72 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
| 73 namespace chromeos { |
| 74 class DOMBrowserView; |
| 75 } |
| 76 #endif |
| 77 |
| 78 // The name of a key to store on the window handle so that other code can |
| 79 // locate this object using just the handle. |
| 80 const char* const kBrowserViewKey = "__BROWSER_VIEW__"; |
| 81 |
| 72 /////////////////////////////////////////////////////////////////////////////// | 82 /////////////////////////////////////////////////////////////////////////////// |
| 73 // BrowserView | 83 // BrowserView |
| 74 // | 84 // |
| 75 // A ClientView subclass that provides the contents of a browser window, | 85 // A ClientView subclass that provides the contents of a browser window, |
| 76 // including the TabStrip, toolbars, download shelves, the content area etc. | 86 // including the TabStrip, toolbars, download shelves, the content area etc. |
| 77 // | 87 // |
| 78 class BrowserView : public BrowserBubbleHost, | 88 class BrowserView : public BrowserBubbleHost, |
| 79 public BrowserWindow, | 89 public BrowserWindow, |
| 80 public BrowserWindowTesting, | 90 public BrowserWindowTesting, |
| 81 public NotificationObserver, | 91 public NotificationObserver, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 | 117 |
| 108 // Returns a Browser instance of this view. | 118 // Returns a Browser instance of this view. |
| 109 Browser* browser() const { return browser_.get(); } | 119 Browser* browser() const { return browser_.get(); } |
| 110 | 120 |
| 111 // Returns the show flag that should be used to show the frame containing | 121 // Returns the show flag that should be used to show the frame containing |
| 112 // this view. | 122 // this view. |
| 113 int GetShowState() const; | 123 int GetShowState() const; |
| 114 | 124 |
| 115 // Called by the frame to notify the BrowserView that it was moved, and that | 125 // Called by the frame to notify the BrowserView that it was moved, and that |
| 116 // any dependent popup windows should be repositioned. | 126 // any dependent popup windows should be repositioned. |
| 117 void WindowMoved(); | 127 virtual void WindowMoved(); |
| 118 | 128 |
| 119 // Called by the frame to notify the BrowserView that a move or resize was | 129 // Called by the frame to notify the BrowserView that a move or resize was |
| 120 // initiated. | 130 // initiated. |
| 121 void WindowMoveOrResizeStarted(); | 131 virtual void WindowMoveOrResizeStarted(); |
| 122 | 132 |
| 123 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. | 133 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. |
| 124 // These differ from |toolbar_.bounds()| in that they match where the toolbar | 134 // These differ from |toolbar_.bounds()| in that they match where the toolbar |
| 125 // background image is drawn -- slightly outside the "true" bounds | 135 // background image is drawn -- slightly outside the "true" bounds |
| 126 // horizontally, and, when using vertical tabs, behind the tab column. | 136 // horizontally, and, when using vertical tabs, behind the tab column. |
| 127 gfx::Rect GetToolbarBounds() const; | 137 virtual gfx::Rect GetToolbarBounds() const; |
| 128 | 138 |
| 129 // Returns the bounds of the content area, in the coordinates of the | 139 // Returns the bounds of the content area, in the coordinates of the |
| 130 // BrowserView's parent. | 140 // BrowserView's parent. |
| 131 gfx::Rect GetClientAreaBounds() const; | 141 gfx::Rect GetClientAreaBounds() const; |
| 132 | 142 |
| 133 // Returns the constraining bounding box that should be used to lay out the | 143 // Returns the constraining bounding box that should be used to lay out the |
| 134 // FindBar within. This is _not_ the size of the find bar, just the bounding | 144 // FindBar within. This is _not_ the size of the find bar, just the bounding |
| 135 // box it should be laid out within. The coordinate system of the returned | 145 // box it should be laid out within. The coordinate system of the returned |
| 136 // rect is in the coordinate system of the frame, since the FindBar is a child | 146 // rect is in the coordinate system of the frame, since the FindBar is a child |
| 137 // window. | 147 // window. |
| 138 gfx::Rect GetFindBarBoundingBox() const; | 148 gfx::Rect GetFindBarBoundingBox() const; |
| 139 | 149 |
| 140 // Returns the preferred height of the TabStrip. Used to position the OTR | 150 // Returns the preferred height of the TabStrip. Used to position the OTR |
| 141 // avatar icon. | 151 // avatar icon. |
| 142 int GetTabStripHeight() const; | 152 virtual int GetTabStripHeight() const; |
| 143 | 153 |
| 144 // Takes some view's origin (relative to this BrowserView) and offsets it such | 154 // Takes some view's origin (relative to this BrowserView) and offsets it such |
| 145 // that it can be used as the source origin for seamlessly tiling the toolbar | 155 // that it can be used as the source origin for seamlessly tiling the toolbar |
| 146 // background image over that view. | 156 // background image over that view. |
| 147 gfx::Point OffsetPointForToolbarBackgroundImage( | 157 gfx::Point OffsetPointForToolbarBackgroundImage( |
| 148 const gfx::Point& point) const; | 158 const gfx::Point& point) const; |
| 149 | 159 |
| 150 // Returns the width of the currently displayed sidebar or 0. | 160 // Returns the width of the currently displayed sidebar or 0. |
| 151 int GetSidebarWidth() const; | 161 int GetSidebarWidth() const; |
| 152 | 162 |
| 153 // Accessor for the TabStrip. | 163 // Accessor for the TabStrip. |
| 154 BaseTabStrip* tabstrip() const { return tabstrip_; } | 164 BaseTabStrip* tabstrip() const { return tabstrip_; } |
| 155 | 165 |
| 156 // Accessor for the Toolbar. | 166 // Accessor for the Toolbar. |
| 157 ToolbarView* toolbar() const { return toolbar_; } | 167 ToolbarView* toolbar() const { return toolbar_; } |
| 158 | 168 |
| 159 // Returns true if various window components are visible. | 169 // Returns true if various window components are visible. |
| 160 bool IsTabStripVisible() const; | 170 virtual bool IsTabStripVisible() const; |
| 161 | 171 |
| 162 // Returns true if the vertical tabstrip is in use. | 172 // Returns true if the vertical tabstrip is in use. |
| 163 bool UseVerticalTabs() const; | 173 bool UseVerticalTabs() const; |
| 164 | 174 |
| 165 // Returns true if the profile associated with this Browser window is | 175 // Returns true if the profile associated with this Browser window is |
| 166 // off the record. | 176 // off the record. |
| 167 bool IsOffTheRecord() const; | 177 bool IsOffTheRecord() const; |
| 168 | 178 |
| 169 // Returns true if the non-client view should render the Off-The-Record | 179 // Returns true if the non-client view should render the Off-The-Record |
| 170 // avatar icon if the window is off the record. | 180 // avatar icon if the window is off the record. |
| 171 bool ShouldShowOffTheRecordAvatar() const; | 181 bool ShouldShowOffTheRecordAvatar() const; |
| 172 | 182 |
| 173 // Handle the specified |accelerator| being pressed. | 183 // Handle the specified |accelerator| being pressed. |
| 174 bool AcceleratorPressed(const views::Accelerator& accelerator); | 184 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
| 175 | 185 |
| 176 // Provides the containing frame with the accelerator for the specified | 186 // Provides the containing frame with the accelerator for the specified |
| 177 // command id. This can be used to provide menu item shortcut hints etc. | 187 // command id. This can be used to provide menu item shortcut hints etc. |
| 178 // Returns true if an accelerator was found for the specified |cmd_id|, false | 188 // Returns true if an accelerator was found for the specified |cmd_id|, false |
| 179 // otherwise. | 189 // otherwise. |
| 180 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); | 190 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); |
| 181 | 191 |
| 182 // Shows the next app-modal dialog box, if there is one to be shown, or moves | 192 // Shows the next app-modal dialog box, if there is one to be shown, or moves |
| 183 // an existing showing one to the front. Returns true if one was shown or | 193 // an existing showing one to the front. Returns true if one was shown or |
| 184 // activated, false if none was shown. | 194 // activated, false if none was shown. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // Factory Methods. | 436 // Factory Methods. |
| 427 // Returns a new LayoutManager for this browser view. A subclass may | 437 // Returns a new LayoutManager for this browser view. A subclass may |
| 428 // override to implemnet different layout pocily. | 438 // override to implemnet different layout pocily. |
| 429 virtual views::LayoutManager* CreateLayoutManager() const; | 439 virtual views::LayoutManager* CreateLayoutManager() const; |
| 430 | 440 |
| 431 // Initializes a new TabStrip for the browser view. This can be performed | 441 // Initializes a new TabStrip for the browser view. This can be performed |
| 432 // multiple times over the life of the browser, and is run when the display | 442 // multiple times over the life of the browser, and is run when the display |
| 433 // mode for the tabstrip changes from horizontal to vertical. | 443 // mode for the tabstrip changes from horizontal to vertical. |
| 434 virtual void InitTabStrip(TabStripModel* tab_strip_model); | 444 virtual void InitTabStrip(TabStripModel* tab_strip_model); |
| 435 | 445 |
| 446 // Initializes the Toolbar. This is factored out of Init to allow for |
| 447 // overriding. |
| 448 virtual void InitToolbar(Browser* browser); |
| 449 |
| 436 // Browser window related initializations. | 450 // Browser window related initializations. |
| 437 virtual void Init(); | 451 virtual void Init(); |
| 438 | 452 |
| 439 private: | 453 private: |
| 440 friend class BrowserViewLayout; | 454 friend class BrowserViewLayout; |
| 441 | 455 |
| 456 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
| 457 friend class chromeos::DOMBrowserView; |
| 458 #endif |
| 459 |
| 442 #if defined(OS_WIN) | 460 #if defined(OS_WIN) |
| 443 // Creates the system menu. | 461 // Creates the system menu. |
| 444 void InitSystemMenu(); | 462 void InitSystemMenu(); |
| 445 #endif | 463 #endif |
| 446 | 464 |
| 447 // Get the X value, in this BrowserView's coordinate system, where | 465 // Get the X value, in this BrowserView's coordinate system, where |
| 448 // the points of the infobar arrows should be anchored. This is the | 466 // the points of the infobar arrows should be anchored. This is the |
| 449 // center of the omnibox location icon. | 467 // center of the omnibox location icon. |
| 450 int GetInfoBarArrowCenterX() const; | 468 int GetInfoBarArrowCenterX() const; |
| 451 | 469 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 #if defined(OS_WIN) | 521 #if defined(OS_WIN) |
| 504 // Builds the correct menu for when we have minimal chrome. | 522 // Builds the correct menu for when we have minimal chrome. |
| 505 void BuildSystemMenuForBrowserWindow(); | 523 void BuildSystemMenuForBrowserWindow(); |
| 506 void BuildSystemMenuForAppOrPopupWindow(bool is_app); | 524 void BuildSystemMenuForAppOrPopupWindow(bool is_app); |
| 507 #endif | 525 #endif |
| 508 | 526 |
| 509 // Retrieves the command id for the specified Windows app command. | 527 // Retrieves the command id for the specified Windows app command. |
| 510 int GetCommandIDForAppCommandID(int app_command_id) const; | 528 int GetCommandIDForAppCommandID(int app_command_id) const; |
| 511 | 529 |
| 512 // Callback for the loading animation(s) associated with this view. | 530 // Callback for the loading animation(s) associated with this view. |
| 513 void LoadingAnimationCallback(); | 531 virtual void LoadingAnimationCallback(); |
| 514 | 532 |
| 515 // Initialize the hung plugin detector. | 533 // Initialize the hung plugin detector. |
| 516 void InitHangMonitor(); | 534 void InitHangMonitor(); |
| 517 | 535 |
| 518 // Possibly records a user metrics action corresponding to the passed-in | 536 // Possibly records a user metrics action corresponding to the passed-in |
| 519 // accelerator. Only implemented for Chrome OS, where we're interested in | 537 // accelerator. Only implemented for Chrome OS, where we're interested in |
| 520 // learning about how frequently the top-row keys are used. | 538 // learning about how frequently the top-row keys are used. |
| 521 void UpdateAcceleratorMetrics(const views::Accelerator& accelerator, | 539 void UpdateAcceleratorMetrics(const views::Accelerator& accelerator, |
| 522 int command_id); | 540 int command_id); |
| 523 | 541 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 695 |
| 678 NotificationRegistrar registrar_; | 696 NotificationRegistrar registrar_; |
| 679 | 697 |
| 680 // Used to measure the loading spinner animation rate. | 698 // Used to measure the loading spinner animation rate. |
| 681 base::TimeTicks last_animation_time_; | 699 base::TimeTicks last_animation_time_; |
| 682 | 700 |
| 683 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 701 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 684 }; | 702 }; |
| 685 | 703 |
| 686 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 704 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |