| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // command id. This can be used to provide menu item shortcut hints etc. | 168 // command id. This can be used to provide menu item shortcut hints etc. |
| 169 // Returns true if an accelerator was found for the specified |cmd_id|, false | 169 // Returns true if an accelerator was found for the specified |cmd_id|, false |
| 170 // otherwise. | 170 // otherwise. |
| 171 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); | 171 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); |
| 172 | 172 |
| 173 // Shows the next app-modal dialog box, if there is one to be shown, or moves | 173 // Shows the next app-modal dialog box, if there is one to be shown, or moves |
| 174 // an existing showing one to the front. Returns true if one was shown or | 174 // an existing showing one to the front. Returns true if one was shown or |
| 175 // activated, false if none was shown. | 175 // activated, false if none was shown. |
| 176 bool ActivateAppModalDialog() const; | 176 bool ActivateAppModalDialog() const; |
| 177 | 177 |
| 178 // Returns the selected WebContents/TabContentsWrapper. Used by our | 178 // Returns the selected WebContents/TabContents. Used by our |
| 179 // NonClientView's TabIconView::TabContentsProvider implementations. | 179 // NonClientView's TabIconView::TabContentsProvider implementations. |
| 180 // TODO(beng): exposing this here is a bit bogus, since it's only used to | 180 // TODO(beng): exposing this here is a bit bogus, since it's only used to |
| 181 // determine loading state. It'd be nicer if we could change this to be | 181 // determine loading state. It'd be nicer if we could change this to be |
| 182 // bool IsSelectedTabLoading() const; or something like that. We could even | 182 // bool IsSelectedTabLoading() const; or something like that. We could even |
| 183 // move it to a WindowDelegate subclass. | 183 // move it to a WindowDelegate subclass. |
| 184 content::WebContents* GetSelectedWebContents() const; | 184 content::WebContents* GetActiveWebContents() const; |
| 185 TabContentsWrapper* GetSelectedTabContentsWrapper() const; | 185 TabContents* GetActiveTabContents() const; |
| 186 | 186 |
| 187 // Retrieves the icon to use in the frame to indicate an OTR window. | 187 // Retrieves the icon to use in the frame to indicate an OTR window. |
| 188 gfx::ImageSkia GetOTRAvatarIcon() const; | 188 gfx::ImageSkia GetOTRAvatarIcon() const; |
| 189 | 189 |
| 190 // Returns true if the Browser object associated with this BrowserView is a | 190 // Returns true if the Browser object associated with this BrowserView is a |
| 191 // tabbed-type window (i.e. a browser window, not an app or popup). | 191 // tabbed-type window (i.e. a browser window, not an app or popup). |
| 192 bool IsBrowserTypeNormal() const { | 192 bool IsBrowserTypeNormal() const { |
| 193 return browser_->is_type_tabbed(); | 193 return browser_->is_type_tabbed(); |
| 194 } | 194 } |
| 195 | 195 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 virtual void EnterFullscreen( | 250 virtual void EnterFullscreen( |
| 251 const GURL& url, FullscreenExitBubbleType bubble_type) OVERRIDE; | 251 const GURL& url, FullscreenExitBubbleType bubble_type) OVERRIDE; |
| 252 virtual void ExitFullscreen() OVERRIDE; | 252 virtual void ExitFullscreen() OVERRIDE; |
| 253 virtual void UpdateFullscreenExitBubbleContent( | 253 virtual void UpdateFullscreenExitBubbleContent( |
| 254 const GURL& url, | 254 const GURL& url, |
| 255 FullscreenExitBubbleType bubble_type) OVERRIDE; | 255 FullscreenExitBubbleType bubble_type) OVERRIDE; |
| 256 virtual bool IsFullscreen() const OVERRIDE; | 256 virtual bool IsFullscreen() const OVERRIDE; |
| 257 virtual LocationBar* GetLocationBar() const OVERRIDE; | 257 virtual LocationBar* GetLocationBar() const OVERRIDE; |
| 258 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; | 258 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; |
| 259 virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; | 259 virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; |
| 260 virtual void UpdateToolbar(TabContentsWrapper* contents, | 260 virtual void UpdateToolbar(TabContents* contents, |
| 261 bool should_restore_state) OVERRIDE; | 261 bool should_restore_state) OVERRIDE; |
| 262 virtual void FocusToolbar() OVERRIDE; | 262 virtual void FocusToolbar() OVERRIDE; |
| 263 virtual void FocusAppMenu() OVERRIDE; | 263 virtual void FocusAppMenu() OVERRIDE; |
| 264 virtual void FocusBookmarksToolbar() OVERRIDE; | 264 virtual void FocusBookmarksToolbar() OVERRIDE; |
| 265 virtual void RotatePaneFocus(bool forwards) OVERRIDE; | 265 virtual void RotatePaneFocus(bool forwards) OVERRIDE; |
| 266 virtual void DestroyBrowser() OVERRIDE; | 266 virtual void DestroyBrowser() OVERRIDE; |
| 267 virtual bool IsBookmarkBarVisible() const OVERRIDE; | 267 virtual bool IsBookmarkBarVisible() const OVERRIDE; |
| 268 virtual bool IsBookmarkBarAnimating() const OVERRIDE; | 268 virtual bool IsBookmarkBarAnimating() const OVERRIDE; |
| 269 virtual bool IsTabStripEditable() const OVERRIDE; | 269 virtual bool IsTabStripEditable() const OVERRIDE; |
| 270 virtual bool IsToolbarVisible() const OVERRIDE; | 270 virtual bool IsToolbarVisible() const OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 291 virtual DownloadShelf* GetDownloadShelf() OVERRIDE; | 291 virtual DownloadShelf* GetDownloadShelf() OVERRIDE; |
| 292 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; | 292 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; |
| 293 virtual void UserChangedTheme() OVERRIDE; | 293 virtual void UserChangedTheme() OVERRIDE; |
| 294 virtual int GetExtraRenderViewHeight() const OVERRIDE; | 294 virtual int GetExtraRenderViewHeight() const OVERRIDE; |
| 295 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; | 295 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; |
| 296 virtual void ShowPageInfo(Profile* profile, | 296 virtual void ShowPageInfo(Profile* profile, |
| 297 const GURL& url, | 297 const GURL& url, |
| 298 const content::SSLStatus& ssl, | 298 const content::SSLStatus& ssl, |
| 299 bool show_history) OVERRIDE; | 299 bool show_history) OVERRIDE; |
| 300 virtual void ShowWebsiteSettings(Profile* profile, | 300 virtual void ShowWebsiteSettings(Profile* profile, |
| 301 TabContentsWrapper* tab_contents_wrapper, | 301 TabContents* tab_contents, |
| 302 const GURL& url, | 302 const GURL& url, |
| 303 const content::SSLStatus& ssl, | 303 const content::SSLStatus& ssl, |
| 304 bool show_history) OVERRIDE; | 304 bool show_history) OVERRIDE; |
| 305 virtual void ShowAppMenu() OVERRIDE; | 305 virtual void ShowAppMenu() OVERRIDE; |
| 306 virtual bool PreHandleKeyboardEvent( | 306 virtual bool PreHandleKeyboardEvent( |
| 307 const content::NativeWebKeyboardEvent& event, | 307 const content::NativeWebKeyboardEvent& event, |
| 308 bool* is_keyboard_shortcut) OVERRIDE; | 308 bool* is_keyboard_shortcut) OVERRIDE; |
| 309 virtual void HandleKeyboardEvent( | 309 virtual void HandleKeyboardEvent( |
| 310 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 310 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 311 virtual void ShowCreateWebAppShortcutsDialog( | 311 virtual void ShowCreateWebAppShortcutsDialog( |
| 312 TabContentsWrapper* tab_contents) OVERRIDE; | 312 TabContents* tab_contents) OVERRIDE; |
| 313 virtual void ShowCreateChromeAppShortcutsDialog( | 313 virtual void ShowCreateChromeAppShortcutsDialog( |
| 314 Profile*, const extensions::Extension* app) OVERRIDE; | 314 Profile*, const extensions::Extension* app) OVERRIDE; |
| 315 virtual void Cut() OVERRIDE; | 315 virtual void Cut() OVERRIDE; |
| 316 virtual void Copy() OVERRIDE; | 316 virtual void Copy() OVERRIDE; |
| 317 virtual void Paste() OVERRIDE; | 317 virtual void Paste() OVERRIDE; |
| 318 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; | 318 virtual void ShowInstant(TabContents* preview) OVERRIDE; |
| 319 virtual void HideInstant() OVERRIDE; | 319 virtual void HideInstant() OVERRIDE; |
| 320 virtual gfx::Rect GetInstantBounds() OVERRIDE; | 320 virtual gfx::Rect GetInstantBounds() OVERRIDE; |
| 321 virtual WindowOpenDisposition GetDispositionForPopupBounds( | 321 virtual WindowOpenDisposition GetDispositionForPopupBounds( |
| 322 const gfx::Rect& bounds) OVERRIDE; | 322 const gfx::Rect& bounds) OVERRIDE; |
| 323 virtual FindBar* CreateFindBar() OVERRIDE; | 323 virtual FindBar* CreateFindBar() OVERRIDE; |
| 324 virtual void ShowAvatarBubble(content::WebContents* web_contents, | 324 virtual void ShowAvatarBubble(content::WebContents* web_contents, |
| 325 const gfx::Rect& rect) OVERRIDE; | 325 const gfx::Rect& rect) OVERRIDE; |
| 326 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; | 326 virtual void ShowAvatarBubbleFromAvatarButton() OVERRIDE; |
| 327 virtual void ShowPasswordGenerationBubble( | 327 virtual void ShowPasswordGenerationBubble( |
| 328 const gfx::Rect& rect, | 328 const gfx::Rect& rect, |
| 329 autofill::PasswordGenerator* password_generator, | 329 autofill::PasswordGenerator* password_generator, |
| 330 const webkit::forms::PasswordForm& form) OVERRIDE; | 330 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 331 | 331 |
| 332 // Overridden from BrowserWindowTesting: | 332 // Overridden from BrowserWindowTesting: |
| 333 virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE; | 333 virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE; |
| 334 virtual LocationBarView* GetLocationBarView() const OVERRIDE; | 334 virtual LocationBarView* GetLocationBarView() const OVERRIDE; |
| 335 virtual views::View* GetTabContentsContainerView() const OVERRIDE; | 335 virtual views::View* GetTabContentsContainerView() const OVERRIDE; |
| 336 virtual ToolbarView* GetToolbarView() const OVERRIDE; | 336 virtual ToolbarView* GetToolbarView() const OVERRIDE; |
| 337 | 337 |
| 338 // Overridden from TabStripModelObserver: | 338 // Overridden from TabStripModelObserver: |
| 339 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; | 339 virtual void TabDetachedAt(TabContents* contents, int index) OVERRIDE; |
| 340 virtual void TabDeactivated(TabContentsWrapper* contents) OVERRIDE; | 340 virtual void TabDeactivated(TabContents* contents) OVERRIDE; |
| 341 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 341 virtual void ActiveTabChanged(TabContents* old_contents, |
| 342 TabContentsWrapper* new_contents, | 342 TabContents* new_contents, |
| 343 int index, | 343 int index, |
| 344 bool user_gesture) OVERRIDE; | 344 bool user_gesture) OVERRIDE; |
| 345 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 345 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 346 TabContentsWrapper* old_contents, | 346 TabContents* old_contents, |
| 347 TabContentsWrapper* new_contents, | 347 TabContents* new_contents, |
| 348 int index) OVERRIDE; | 348 int index) OVERRIDE; |
| 349 virtual void TabStripEmpty() OVERRIDE; | 349 virtual void TabStripEmpty() OVERRIDE; |
| 350 | 350 |
| 351 // Overridden from ui::AcceleratorProvider: | 351 // Overridden from ui::AcceleratorProvider: |
| 352 virtual bool GetAcceleratorForCommandId(int command_id, | 352 virtual bool GetAcceleratorForCommandId(int command_id, |
| 353 ui::Accelerator* accelerator) OVERRIDE; | 353 ui::Accelerator* accelerator) OVERRIDE; |
| 354 | 354 |
| 355 // Overridden from views::WidgetDelegate: | 355 // Overridden from views::WidgetDelegate: |
| 356 virtual bool CanResize() const OVERRIDE; | 356 virtual bool CanResize() const OVERRIDE; |
| 357 virtual bool CanMaximize() const OVERRIDE; | 357 virtual bool CanMaximize() const OVERRIDE; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 GURL url; | 451 GURL url; |
| 452 FullscreenExitBubbleType bubble_type; | 452 FullscreenExitBubbleType bubble_type; |
| 453 }; | 453 }; |
| 454 | 454 |
| 455 // Returns the BrowserViewLayout. | 455 // Returns the BrowserViewLayout. |
| 456 BrowserViewLayout* GetBrowserViewLayout() const; | 456 BrowserViewLayout* GetBrowserViewLayout() const; |
| 457 | 457 |
| 458 // Layout the Status Bubble. | 458 // Layout the Status Bubble. |
| 459 void LayoutStatusBubble(); | 459 void LayoutStatusBubble(); |
| 460 | 460 |
| 461 // Prepare to show the Bookmark Bar for the specified TabContentsWrapper. | 461 // Prepare to show the Bookmark Bar for the specified TabContents. |
| 462 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this | 462 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this |
| 463 // Browser type) and there should be a subsequent re-layout to show it. | 463 // Browser type) and there should be a subsequent re-layout to show it. |
| 464 // |contents| can be NULL. | 464 // |contents| can be NULL. |
| 465 bool MaybeShowBookmarkBar(TabContentsWrapper* contents); | 465 bool MaybeShowBookmarkBar(TabContents* contents); |
| 466 | 466 |
| 467 // Prepare to show an Info Bar for the specified TabContentsWrapper. Returns | 467 // Prepare to show an Info Bar for the specified TabContents. Returns |
| 468 // true if there is an Info Bar to show and one is supported for this Browser | 468 // true if there is an Info Bar to show and one is supported for this Browser |
| 469 // type, and there should be a subsequent re-layout to show it. | 469 // type, and there should be a subsequent re-layout to show it. |
| 470 // |contents| can be NULL. | 470 // |contents| can be NULL. |
| 471 bool MaybeShowInfoBar(TabContentsWrapper* contents); | 471 bool MaybeShowInfoBar(TabContents* contents); |
| 472 | 472 |
| 473 // Shows docked devtools. | 473 // Shows docked devtools. |
| 474 void ShowDevToolsContainer(); | 474 void ShowDevToolsContainer(); |
| 475 | 475 |
| 476 // Hides docked devtools. | 476 // Hides docked devtools. |
| 477 void HideDevToolsContainer(); | 477 void HideDevToolsContainer(); |
| 478 | 478 |
| 479 // Updated devtools window for given contents. | 479 // Updated devtools window for given contents. |
| 480 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents); | 480 void UpdateDevToolsForContents(TabContents* tab_contents); |
| 481 | 481 |
| 482 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the | 482 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the |
| 483 // Download Shelf in response to a change notification from the specified | 483 // Download Shelf in response to a change notification from the specified |
| 484 // |contents|. |contents| can be NULL. In this case, all optional UI will be | 484 // |contents|. |contents| can be NULL. In this case, all optional UI will be |
| 485 // removed. | 485 // removed. |
| 486 void UpdateUIForContents(TabContentsWrapper* contents); | 486 void UpdateUIForContents(TabContents* contents); |
| 487 | 487 |
| 488 // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download | 488 // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download |
| 489 // Shelf. If |*old_view| differs from new_view, the old_view is removed and | 489 // Shelf. If |*old_view| differs from new_view, the old_view is removed and |
| 490 // the new_view is added. This is intended to be used when swapping in/out | 490 // the new_view is added. This is intended to be used when swapping in/out |
| 491 // child views that are referenced via a field. | 491 // child views that are referenced via a field. |
| 492 // Returns true if anything was changed, and a re-Layout is now required. | 492 // Returns true if anything was changed, and a re-Layout is now required. |
| 493 bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view); | 493 bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view); |
| 494 | 494 |
| 495 // Invoked to update the necessary things when our fullscreen state changes | 495 // Invoked to update the necessary things when our fullscreen state changes |
| 496 // to |fullscreen|. On Windows this is invoked immediately when we toggle the | 496 // to |fullscreen|. On Windows this is invoked immediately when we toggle the |
| (...skipping 19 matching lines...) Expand all Loading... |
| 516 void InitHangMonitor(); | 516 void InitHangMonitor(); |
| 517 | 517 |
| 518 // Possibly records a user metrics action corresponding to the passed-in | 518 // Possibly records a user metrics action corresponding to the passed-in |
| 519 // accelerator. Only implemented for Chrome OS, where we're interested in | 519 // accelerator. Only implemented for Chrome OS, where we're interested in |
| 520 // learning about how frequently the top-row keys are used. | 520 // learning about how frequently the top-row keys are used. |
| 521 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator, | 521 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator, |
| 522 int command_id); | 522 int command_id); |
| 523 | 523 |
| 524 // Invoked from ActiveTabChanged or when instant is made active. | 524 // Invoked from ActiveTabChanged or when instant is made active. |
| 525 // |new_contents| must not be NULL. | 525 // |new_contents| must not be NULL. |
| 526 void ProcessTabSelected(TabContentsWrapper* new_contents); | 526 void ProcessTabSelected(TabContents* new_contents); |
| 527 | 527 |
| 528 // Exposes resize corner size to BrowserViewLayout. | 528 // Exposes resize corner size to BrowserViewLayout. |
| 529 gfx::Size GetResizeCornerSize() const; | 529 gfx::Size GetResizeCornerSize() const; |
| 530 | 530 |
| 531 // Shows the about chrome modal dialog and returns the Window object. | 531 // Shows the about chrome modal dialog and returns the Window object. |
| 532 views::Widget* DoShowAboutChromeDialog(); | 532 views::Widget* DoShowAboutChromeDialog(); |
| 533 | 533 |
| 534 // Set the value of |toolbar_| and hook it into the views hierarchy | 534 // Set the value of |toolbar_| and hook it into the views hierarchy |
| 535 void SetToolbar(ToolbarView* toolbar); | 535 void SetToolbar(ToolbarView* toolbar); |
| 536 | 536 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 bool force_location_bar_focus_; | 683 bool force_location_bar_focus_; |
| 684 | 684 |
| 685 PendingFullscreenRequest fullscreen_request_; | 685 PendingFullscreenRequest fullscreen_request_; |
| 686 | 686 |
| 687 gfx::ScopedSysColorChangeListener color_change_listener_; | 687 gfx::ScopedSysColorChangeListener color_change_listener_; |
| 688 | 688 |
| 689 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 689 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 690 }; | 690 }; |
| 691 | 691 |
| 692 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 692 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |