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