Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / browser_view.h
blob1a9a8df616ff651bb8311faa004ce639f9419481
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/timer/timer.h"
15 #include "build/build_config.h"
16 #include "chrome/browser/devtools/devtools_window.h"
17 #include "chrome/browser/signin/signin_header_helper.h"
18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
21 #include "chrome/browser/ui/infobar_container_delegate.h"
22 #include "chrome/browser/ui/omnibox/omnibox_popup_model_observer.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
24 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
25 #include "chrome/browser/ui/views/frame/browser_frame.h"
26 #include "chrome/browser/ui/views/frame/contents_web_view.h"
27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
28 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
29 #include "chrome/browser/ui/views/load_complete_listener.h"
30 #include "ui/base/accelerators/accelerator.h"
31 #include "ui/base/models/simple_menu_model.h"
32 #include "ui/gfx/native_widget_types.h"
33 #include "ui/views/controls/button/button.h"
34 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
35 #include "ui/views/widget/widget_delegate.h"
36 #include "ui/views/widget/widget_observer.h"
37 #include "ui/views/window/client_view.h"
39 #if defined(OS_WIN)
40 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
41 #include "chrome/browser/hang_monitor/hung_window_detector.h"
42 #endif
44 // NOTE: For more information about the objects and files in this directory,
45 // view: http://dev.chromium.org/developers/design-documents/browser-window
47 class BookmarkBarView;
48 class Browser;
49 class BrowserViewLayout;
50 class ContentsLayoutManager;
51 class DownloadShelfView;
52 class ExclusiveAccessBubbleViews;
53 class InfoBarContainerView;
54 class LocationBarView;
55 class PermissionBubbleViewViews;
56 class StatusBubbleViews;
57 class TabStrip;
58 class ToolbarView;
59 class TopContainerView;
60 class WebContentsCloseHandler;
62 #if defined(OS_WIN)
63 class JumpList;
64 #endif
66 namespace extensions {
67 class Extension;
70 namespace views {
71 class AccessiblePaneView;
72 class ExternalFocusTracker;
73 class WebView;
76 ///////////////////////////////////////////////////////////////////////////////
77 // BrowserView
79 // A ClientView subclass that provides the contents of a browser window,
80 // including the TabStrip, toolbars, download shelves, the content area etc.
82 class BrowserView : public BrowserWindow,
83 public TabStripModelObserver,
84 public ui::AcceleratorProvider,
85 public views::WidgetDelegate,
86 public views::WidgetObserver,
87 public views::ClientView,
88 public InfoBarContainerDelegate,
89 public LoadCompleteListener::Delegate,
90 public OmniboxPopupModelObserver,
91 public ExclusiveAccessContext,
92 public ExclusiveAccessBubbleViewsContext {
93 public:
94 // The browser view's class name.
95 static const char kViewClassName[];
97 BrowserView();
98 ~BrowserView() override;
100 // Takes ownership of |browser|.
101 void Init(Browser* browser);
103 void set_frame(BrowserFrame* frame) { frame_ = frame; }
104 BrowserFrame* frame() const { return frame_; }
106 // Returns a pointer to the BrowserView* interface implementation (an
107 // instance of this object, typically) for a given native window, or null if
108 // there is no such association.
110 // Don't use this unless you only have a NativeWindow. In nearly all
111 // situations plumb through browser and use it.
112 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
114 // Returns the BrowserView used for the specified Browser.
115 static BrowserView* GetBrowserViewForBrowser(const Browser* browser);
117 // Returns a Browser instance of this view.
118 Browser* browser() { return browser_.get(); }
119 const Browser* browser() const { return browser_.get(); }
121 // Initializes (or re-initializes) the status bubble. We try to only create
122 // the bubble once and re-use it for the life of the browser, but certain
123 // events (such as changing enabling/disabling Aero on Win) can force a need
124 // to change some of the bubble's creation parameters.
125 void InitStatusBubble();
127 // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
128 // These differ from |toolbar_.bounds()| in that they match where the toolbar
129 // background image is drawn -- slightly outside the "true" bounds
130 // horizontally. Note that this returns the bounds for the toolbar area.
131 gfx::Rect GetToolbarBounds() const;
133 // 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
135 // 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
137 // window.
138 gfx::Rect GetFindBarBoundingBox() const;
140 // Returns the preferred height of the TabStrip. Used to position the OTR
141 // avatar icon.
142 int GetTabStripHeight() const;
144 // 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
146 // background image over that view.
147 gfx::Point OffsetPointForToolbarBackgroundImage(
148 const gfx::Point& point) const;
150 // Container for the tabstrip, toolbar, etc.
151 TopContainerView* top_container() { return top_container_; }
153 // Accessor for the TabStrip.
154 TabStrip* tabstrip() { return tabstrip_; }
156 // Accessor for the Toolbar.
157 ToolbarView* toolbar() { return toolbar_; }
159 // Bookmark bar may be null, for example for pop-ups.
160 BookmarkBarView* bookmark_bar() { return bookmark_bar_view_.get(); }
162 // Returns the do-nothing view which controls the z-order of the find bar
163 // widget relative to views which paint into layers and views which have an
164 // associated NativeView. The presence / visibility of this view is not
165 // indicative of the visibility of the find bar widget or even whether
166 // FindBarController is initialized.
167 View* find_bar_host_view() { return find_bar_host_view_; }
169 // Accessor for the InfobarContainer.
170 InfoBarContainerView* infobar_container() { return infobar_container_; }
172 // Accessor for the FullscreenExitBubbleViews.
173 ExclusiveAccessBubbleViews* exclusive_access_bubble() {
174 return exclusive_access_bubble_.get();
177 // Returns true if various window components are visible.
178 bool IsTabStripVisible() const;
180 // Returns true if the profile associated with this Browser window is
181 // incognito.
182 bool IsOffTheRecord() const;
184 // Returns true if the profile associated with this Browser window is
185 // a guest session.
186 bool IsGuestSession() const;
188 // Returns true if the profile associated with this Browser window is
189 // not off the record or a guest session.
190 bool IsRegularOrGuestSession() const;
192 // Returns true if the non-client view should render an avatar icon.
193 bool ShouldShowAvatar() const;
195 // Provides the containing frame with the accelerator for the specified
196 // command id. This can be used to provide menu item shortcut hints etc.
197 // Returns true if an accelerator was found for the specified |cmd_id|, false
198 // otherwise.
199 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const;
201 // Returns true if the specificed |accelerator| is registered with this view.
202 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator);
204 // Returns the active WebContents. Used by our NonClientView's
205 // TabIconView::TabContentsProvider implementations.
206 // TODO(beng): exposing this here is a bit bogus, since it's only used to
207 // determine loading state. It'd be nicer if we could change this to be
208 // bool IsSelectedTabLoading() const; or something like that. We could even
209 // move it to a WindowDelegate subclass.
210 content::WebContents* GetActiveWebContents() const;
212 // Retrieves the icon to use in the frame to indicate an OTR window.
213 gfx::ImageSkia GetOTRAvatarIcon() const;
215 // Returns true if the Browser object associated with this BrowserView is a
216 // tabbed-type window (i.e. a browser window, not an app or popup).
217 bool IsBrowserTypeNormal() const {
218 return browser_->is_type_tabbed();
221 // See ImmersiveModeController for description.
222 ImmersiveModeController* immersive_mode_controller() const {
223 return immersive_mode_controller_.get();
226 // Restores the focused view. This is also used to set the initial focus
227 // when a new browser window is created.
228 void RestoreFocus();
230 // Called after the widget's fullscreen state is changed without going through
231 // FullscreenController. This method does any processing which was skipped.
232 // Only exiting fullscreen in this way is currently supported.
233 void FullscreenStateChanged();
235 // Called from BookmarkBarView/DownloadShelfView during their show/hide
236 // animations.
237 void ToolbarSizeChanged(bool is_animating);
239 // Overridden from BrowserWindow:
240 void Show() override;
241 void ShowInactive() override;
242 void Hide() override;
243 void SetBounds(const gfx::Rect& bounds) override;
244 void Close() override;
245 void Activate() override;
246 void Deactivate() override;
247 bool IsActive() const override;
248 void FlashFrame(bool flash) override;
249 bool IsAlwaysOnTop() const override;
250 void SetAlwaysOnTop(bool always_on_top) override;
251 gfx::NativeWindow GetNativeWindow() const override;
252 StatusBubble* GetStatusBubble() override;
253 void UpdateTitleBar() override;
254 void BookmarkBarStateChanged(
255 BookmarkBar::AnimateChangeType change_type) override;
256 void UpdateDevTools() override;
257 void UpdateLoadingAnimations(bool should_animate) override;
258 void SetStarredState(bool is_starred) override;
259 void SetTranslateIconToggled(bool is_lit) override;
260 void OnActiveTabChanged(content::WebContents* old_contents,
261 content::WebContents* new_contents,
262 int index,
263 int reason) override;
264 void ZoomChangedForActiveTab(bool can_show_bubble) override;
265 gfx::Rect GetRestoredBounds() const override;
266 ui::WindowShowState GetRestoredState() const override;
267 gfx::Rect GetBounds() const override;
268 bool IsMaximized() const override;
269 bool IsMinimized() const override;
270 void Maximize() override;
271 void Minimize() override;
272 void Restore() override;
273 void EnterFullscreen(const GURL& url,
274 ExclusiveAccessBubbleType bubble_type,
275 bool with_toolbar) override;
276 void ExitFullscreen() override;
277 void UpdateExclusiveAccessExitBubbleContent(
278 const GURL& url,
279 ExclusiveAccessBubbleType bubble_type) override;
280 bool ShouldHideUIForFullscreen() const override;
281 bool IsFullscreen() const override;
282 bool IsFullscreenBubbleVisible() const override;
283 bool SupportsFullscreenWithToolbar() const override;
284 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
285 bool IsFullscreenWithToolbar() const override;
286 #if defined(OS_WIN)
287 void SetMetroSnapMode(bool enable) override;
288 bool IsInMetroSnapMode() const override;
289 #endif // defined(OS_WIN)
290 LocationBar* GetLocationBar() const override;
291 void SetFocusToLocationBar(bool select_all) override;
292 void UpdateReloadStopState(bool is_loading, bool force) override;
293 void UpdateToolbar(content::WebContents* contents) override;
294 void ResetToolbarTabState(content::WebContents* contents) override;
295 void FocusToolbar() override;
296 void FocusAppMenu() override;
297 void FocusBookmarksToolbar() override;
298 void FocusInfobars() override;
299 void RotatePaneFocus(bool forwards) override;
300 void DestroyBrowser() override;
301 bool IsBookmarkBarVisible() const override;
302 bool IsBookmarkBarAnimating() const override;
303 bool IsTabStripEditable() const override;
304 bool IsToolbarVisible() const override;
305 gfx::Rect GetRootWindowResizerRect() const override;
306 void ConfirmAddSearchProvider(TemplateURL* template_url,
307 Profile* profile) override;
308 void ShowUpdateChromeDialog() override;
309 void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override;
310 void ShowBookmarkAppBubble(
311 const WebApplicationInfo& web_app_info,
312 const ShowBookmarkAppBubbleCallback& callback) override;
313 void ShowTranslateBubble(content::WebContents* contents,
314 translate::TranslateStep step,
315 translate::TranslateErrors::Type error_type,
316 bool is_user_gesture) override;
317 bool ShowSessionCrashedBubble() override;
318 bool IsProfileResetBubbleSupported() const override;
319 GlobalErrorBubbleViewBase* ShowProfileResetBubble(
320 const base::WeakPtr<ProfileResetGlobalError>& global_error) override;
321 #if defined(ENABLE_ONE_CLICK_SIGNIN)
322 void ShowOneClickSigninBubble(
323 OneClickSigninBubbleType type,
324 const base::string16& email,
325 const base::string16& error_message,
326 const StartSyncCallback& start_sync_callback) override;
327 #endif
328 // TODO(beng): Not an override, move somewhere else.
329 void SetDownloadShelfVisible(bool visible);
330 bool IsDownloadShelfVisible() const override;
331 DownloadShelf* GetDownloadShelf() override;
332 void ConfirmBrowserCloseWithPendingDownloads(
333 int download_count,
334 Browser::DownloadClosePreventionType dialog_type,
335 bool app_modal,
336 const base::Callback<void(bool)>& callback) override;
337 void UserChangedTheme() override;
338 int GetExtraRenderViewHeight() const override;
339 void WebContentsFocused(content::WebContents* contents) override;
340 void ShowWebsiteSettings(Profile* profile,
341 content::WebContents* web_contents,
342 const GURL& url,
343 const content::SSLStatus& ssl) override;
344 void ShowAppMenu() override;
345 bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event,
346 bool* is_keyboard_shortcut) override;
347 void HandleKeyboardEvent(
348 const content::NativeWebKeyboardEvent& event) override;
349 void Cut() override;
350 void Copy() override;
351 void Paste() override;
352 WindowOpenDisposition GetDispositionForPopupBounds(
353 const gfx::Rect& bounds) override;
354 FindBar* CreateFindBar() override;
355 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
356 override;
357 void ShowAvatarBubbleFromAvatarButton(
358 AvatarBubbleMode mode,
359 const signin::ManageAccountsParams& manage_accounts_params) override;
360 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override;
361 void ExecuteExtensionCommand(const extensions::Extension* extension,
362 const extensions::Command& command) override;
363 ExclusiveAccessContext* GetExclusiveAccessContext() override;
365 BookmarkBarView* GetBookmarkBarView() const;
366 LocationBarView* GetLocationBarView() const;
367 views::View* GetTabContentsContainerView() const;
368 ToolbarView* GetToolbarView() const;
370 // Overridden from TabStripModelObserver:
371 void TabInsertedAt(content::WebContents* contents,
372 int index,
373 bool foreground) override;
374 void TabDetachedAt(content::WebContents* contents, int index) override;
375 void TabDeactivated(content::WebContents* contents) override;
376 void TabStripEmpty() override;
377 void WillCloseAllTabs() override;
378 void CloseAllTabsCanceled() override;
380 // Overridden from ui::AcceleratorProvider:
381 bool GetAcceleratorForCommandId(int command_id,
382 ui::Accelerator* accelerator) override;
384 // Overridden from views::WidgetDelegate:
385 bool CanResize() const override;
386 bool CanMaximize() const override;
387 bool CanMinimize() const override;
388 bool CanActivate() const override;
389 base::string16 GetWindowTitle() const override;
390 base::string16 GetAccessibleWindowTitle() const override;
391 views::View* GetInitiallyFocusedView() override;
392 bool ShouldShowWindowTitle() const override;
393 gfx::ImageSkia GetWindowAppIcon() override;
394 gfx::ImageSkia GetWindowIcon() override;
395 bool ShouldShowWindowIcon() const override;
396 bool ExecuteWindowsCommand(int command_id) override;
397 std::string GetWindowName() const override;
398 void SaveWindowPlacement(const gfx::Rect& bounds,
399 ui::WindowShowState show_state) override;
400 bool GetSavedWindowPlacement(const views::Widget* widget,
401 gfx::Rect* bounds,
402 ui::WindowShowState* show_state) const override;
403 views::View* GetContentsView() override;
404 views::ClientView* CreateClientView(views::Widget* widget) override;
405 void OnWindowBeginUserBoundsChange() override;
406 void OnWidgetMove() override;
407 views::Widget* GetWidget() override;
408 const views::Widget* GetWidget() const override;
409 void GetAccessiblePanes(std::vector<View*>* panes) override;
411 // Overridden from views::WidgetObserver:
412 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
414 // Overridden from views::ClientView:
415 bool CanClose() override;
416 int NonClientHitTest(const gfx::Point& point) override;
417 gfx::Size GetMinimumSize() const override;
419 // InfoBarContainerDelegate:
420 SkColor GetInfoBarSeparatorColor() const override;
421 void InfoBarContainerStateChanged(bool is_animating) override;
422 bool DrawInfoBarArrows(int* x) const override;
424 // Overridden from views::View:
425 const char* GetClassName() const override;
426 void Layout() override;
427 void PaintChildren(const PaintContext& context) override;
428 void ViewHierarchyChanged(
429 const ViewHierarchyChangedDetails& details) override;
430 void ChildPreferredSizeChanged(View* child) override;
431 void GetAccessibleState(ui::AXViewState* state) override;
432 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
434 // Overridden from ui::AcceleratorTarget:
435 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
437 // OmniboxPopupModelObserver overrides
438 void OnOmniboxPopupShownOrHidden() override;
440 // ExclusiveAccessContext overrides
441 Profile* GetProfile() override;
442 content::WebContents* GetActiveWebContents() override;
443 void HideDownloadShelf() override;
444 void UnhideDownloadShelf() override;
446 // ExclusiveAccessBubbleViewsContext overrides
447 ExclusiveAccessManager* GetExclusiveAccessManager() override;
448 bool IsImmersiveModeEnabled() override;
449 views::Widget* GetBubbleAssociatedWidget() override;
450 gfx::Rect GetTopContainerBoundsInScreen() override;
452 // Testing interface:
453 views::View* GetContentsContainerForTest() { return contents_container_; }
454 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
455 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
457 private:
458 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
459 // interface to keep these two classes decoupled and testable.
460 friend class BrowserViewLayoutDelegateImpl;
461 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
462 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
463 TestAboutChromeViewAccObj);
465 enum FullscreenMode {
466 NORMAL_FULLSCREEN,
467 METRO_SNAP_FULLSCREEN
470 // Appends to |toolbars| a pointer to each AccessiblePaneView that
471 // can be traversed using F6, in the order they should be traversed.
472 void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes);
474 // Constructs and initializes the child views.
475 void InitViews();
477 // Callback for the loading animation(s) associated with this view.
478 void LoadingAnimationCallback();
480 // LoadCompleteListener::Delegate implementation. Creates and initializes the
481 // |jumplist_| after the first page load.
482 void OnLoadCompleted() override;
484 // Returns the BrowserViewLayout.
485 BrowserViewLayout* GetBrowserViewLayout() const;
487 // Returns the ContentsLayoutManager.
488 ContentsLayoutManager* GetContentsLayoutManager() const;
490 // Prepare to show the Bookmark Bar for the specified WebContents.
491 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this
492 // Browser type) and there should be a subsequent re-layout to show it.
493 // |contents| can be null.
494 bool MaybeShowBookmarkBar(content::WebContents* contents);
496 // Moves the bookmark bar view to the specified parent, which may be null,
497 // |this|, or |top_container_|. Ensures that |top_container_| stays in front
498 // of |bookmark_bar_view_|.
499 void SetBookmarkBarParent(views::View* new_parent);
501 // Prepare to show an Info Bar for the specified WebContents. Returns
502 // true if there is an Info Bar to show and one is supported for this Browser
503 // type, and there should be a subsequent re-layout to show it.
504 // |contents| can be null.
505 bool MaybeShowInfoBar(content::WebContents* contents);
507 // Updates devtools window for given contents. This method will show docked
508 // devtools window for inspected |web_contents| that has docked devtools
509 // and hide it for null or not inspected |web_contents|. It will also make
510 // sure devtools window size and position are restored for given tab.
511 // This method will not update actual DevTools WebContents, if not
512 // |update_devtools_web_contents|. In this case, manual update is required.
513 void UpdateDevToolsForContents(content::WebContents* web_contents,
514 bool update_devtools_web_contents);
516 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
517 // Download Shelf in response to a change notification from the specified
518 // |contents|. |contents| can be null. In this case, all optional UI will be
519 // removed.
520 void UpdateUIForContents(content::WebContents* contents);
522 // Invoked to update the necessary things when our fullscreen state changes
523 // to |fullscreen|. On Windows this is invoked immediately when we toggle the
524 // full screen state. On Linux changing the fullscreen state is async, so we
525 // ask the window to change its fullscreen state, then when we get
526 // notification that it succeeded this method is invoked.
527 // If |url| is not empty, it is the URL of the page that requested fullscreen
528 // (via the fullscreen JS API).
529 // |bubble_type| determines what should be shown in the fullscreen exit
530 // bubble.
531 void ProcessFullscreen(bool fullscreen,
532 FullscreenMode mode,
533 const GURL& url,
534 ExclusiveAccessBubbleType bubble_type);
536 // Returns whether immmersive fullscreen should replace fullscreen. This
537 // should only occur for "browser-fullscreen" for tabbed-typed windows (not
538 // for tab-fullscreen and not for app/popup type windows).
539 bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const;
541 // Copy the accelerator table from the app resources into something we can
542 // use.
543 void LoadAccelerators();
545 // Retrieves the command id for the specified Windows app command.
546 int GetCommandIDForAppCommandID(int app_command_id) const;
548 // Initialize the hung plugin detector.
549 void InitHangMonitor();
551 // Possibly records a user metrics action corresponding to the passed-in
552 // accelerator. Only implemented for Chrome OS, where we're interested in
553 // learning about how frequently the top-row keys are used.
554 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
555 int command_id);
557 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste,
558 // first trying the content WebContents, then the devtools WebContents, and
559 // lastly the Views::Textfield if one is focused.
560 void DoCutCopyPaste(void (content::WebContents::*method)(),
561 int command_id);
563 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
564 // the given WebContents, returning true if it consumed the event.
565 bool DoCutCopyPasteForWebContents(
566 content::WebContents* contents,
567 void (content::WebContents::*method)());
569 // Shows the next app-modal dialog box, if there is one to be shown, or moves
570 // an existing showing one to the front.
571 void ActivateAppModalDialog() const;
573 // Returns the max top arrow height for infobar.
574 int GetMaxTopInfoBarArrowHeight();
576 // Last focused view that issued a tab traversal.
577 int last_focused_view_storage_id_;
579 // The BrowserFrame that hosts this view.
580 BrowserFrame* frame_;
582 // The Browser object we are associated with.
583 scoped_ptr<Browser> browser_;
585 // BrowserView layout (LTR one is pictured here).
587 // --------------------------------------------------------------------
588 // | TopContainerView (top_container_) |
589 // | -------------------------------------------------------------- |
590 // | | Tabs (tabstrip_) | |
591 // | |------------------------------------------------------------| |
592 // | | Navigation buttons, address bar, menu (toolbar_) | |
593 // | -------------------------------------------------------------- |
594 // |------------------------------------------------------------------|
595 // | All infobars (infobar_container_) [1] |
596 // |------------------------------------------------------------------|
597 // | Bookmarks (bookmark_bar_view_) [1] |
598 // |------------------------------------------------------------------|
599 // | Contents container (contents_container_) |
600 // | -------------------------------------------------------------- |
601 // | | devtools_web_view_ | |
602 // | |------------------------------------------------------------| |
603 // | | contents_web_view_ | |
604 // | -------------------------------------------------------------- |
605 // |------------------------------------------------------------------|
606 // | Active downloads (download_shelf_) |
607 // --------------------------------------------------------------------
609 // [1] The bookmark bar and info bar are swapped when on the new tab page.
610 // Additionally when the bookmark bar is detached, contents_container_ is
611 // positioned on top of the bar while the tab's contents are placed below
612 // the bar. This allows the find bar to always align with the top of
613 // contents_container_ regardless if there's bookmark or info bars.
615 // The view that manages the tab strip, toolbar, and sometimes the bookmark
616 // bar. Stacked top in the view hiearachy so it can be used to slide out
617 // the top views in immersive fullscreen.
618 TopContainerView* top_container_;
620 // The TabStrip.
621 TabStrip* tabstrip_;
623 // The Toolbar containing the navigation buttons, menus and the address bar.
624 ToolbarView* toolbar_;
626 // The Bookmark Bar View for this window. Lazily created. May be null for
627 // non-tabbed browsers like popups. May not be visible.
628 scoped_ptr<BookmarkBarView> bookmark_bar_view_;
630 // The do-nothing view which controls the z-order of the find bar widget
631 // relative to views which paint into layers and views with an associated
632 // NativeView.
633 View* find_bar_host_view_;
635 // The download shelf view (view at the bottom of the page).
636 scoped_ptr<DownloadShelfView> download_shelf_;
638 // The InfoBarContainerView that contains InfoBars for the current tab.
639 InfoBarContainerView* infobar_container_;
641 // The view that contains the selected WebContents.
642 ContentsWebView* contents_web_view_;
644 // The view that contains devtools window for the selected WebContents.
645 views::WebView* devtools_web_view_;
647 // The view managing the devtools and contents positions.
648 // Handled by ContentsLayoutManager.
649 views::View* contents_container_;
651 // Tracks and stores the last focused view which is not the
652 // devtools_web_view_ or any of its children. Used to restore focus once
653 // the devtools_web_view_ is hidden.
654 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
656 // The Status information bubble that appears at the bottom of the window.
657 scoped_ptr<StatusBubbleViews> status_bubble_;
659 // The permission bubble view is the toolkit-specific implementation of the
660 // interface used by the manager to display permissions bubbles.
661 scoped_ptr<PermissionBubbleViewViews> permission_bubble_;
663 // A mapping between accelerators and commands.
664 std::map<ui::Accelerator, int> accelerator_table_;
666 // True if we have already been initialized.
667 bool initialized_;
669 // True when in ProcessFullscreen(). The flag is used to avoid reentrance and
670 // to ignore requests to layout while in ProcessFullscreen() to reduce
671 // jankiness.
672 bool in_process_fullscreen_;
674 scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_;
676 #if defined(OS_WIN)
677 // This object is used to perform periodic actions in a worker
678 // thread. It is currently used to monitor hung plugin windows.
679 WorkerThreadTicker ticker_;
681 // This object is initialized with the frame window HWND. This
682 // object is also passed as a tick handler with the ticker_ object.
683 // It is used to periodically monitor for hung plugin windows
684 HungWindowDetector hung_window_detector_;
686 // This object is invoked by hung_window_detector_ when it detects a hung
687 // plugin window.
688 HungPluginAction hung_plugin_action_;
690 // Helper class to listen for completion of first page load.
691 scoped_ptr<LoadCompleteListener> load_complete_listener_;
693 // The custom JumpList for Windows 7.
694 scoped_refptr<JumpList> jumplist_;
695 #endif
697 // The timer used to update frames for the Loading Animation.
698 base::RepeatingTimer<BrowserView> loading_animation_timer_;
700 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
702 // Used to measure the loading spinner animation rate.
703 base::TimeTicks last_animation_time_;
705 // If this flag is set then SetFocusToLocationBar() will set focus to the
706 // location bar even if the browser window is not active.
707 bool force_location_bar_focus_;
709 scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
711 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
713 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
715 DISALLOW_COPY_AND_ASSIGN(BrowserView);
718 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_