diff options
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 3 | ||||
-rw-r--r-- | chrome/views/view.cc | 6 | ||||
-rw-r--r-- | chrome/views/view.h | 4 |
3 files changed, 11 insertions, 2 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 6f1ce19..8830d09 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -914,8 +914,7 @@ void BrowserView::TabSelectedAt(TabContents* old_contents, // etc not result in sad tab. new_contents->DidBecomeSelected(); if (BrowserList::GetLastActive() == browser_ && - !browser_->tabstrip_model()->closing_all() && - GetWidget()->GetWindow()->IsVisible()) { + !browser_->tabstrip_model()->closing_all() && GetWindow()->IsVisible()) { // We only restore focus if our window is visible, to avoid invoking blur // handlers when we are eventually shown. new_contents->view()->RestoreFocus(); diff --git a/chrome/views/view.cc b/chrome/views/view.cc index b2c470a..f509f7d 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -21,6 +21,7 @@ #include "chrome/views/layout_manager.h" #include "chrome/views/widget/root_view.h" #include "chrome/views/widget/widget.h" +#include "chrome/views/window/window.h" #if defined(OS_WIN) #include "chrome/views/widget/tooltip_manager.h" #include "chrome/views/accessibility/view_accessibility_wrapper.h" @@ -746,6 +747,11 @@ Widget* View::GetWidget() const { return parent_ ? parent_->GetWidget() : NULL; } +Window* View::GetWindow() const { + Widget* widget = GetWidget(); + return widget ? widget->GetWindow() : NULL; +} + // Get the containing RootView RootView* View::GetRootView() { Widget* widget = GetWidget(); diff --git a/chrome/views/view.h b/chrome/views/view.h index b502842..98f143c 100644 --- a/chrome/views/view.h +++ b/chrome/views/view.h @@ -45,6 +45,7 @@ class RestoreFocusTask; class RootView; class ScrollView; class Widget; +class Window; // ContextMenuController is responsible for showing the context menu for a // View. To use a ContextMenuController invoke SetContextMenuController on a @@ -433,6 +434,9 @@ class View : public AcceleratorTarget { // Get the Widget that hosts this View, if any. virtual Widget* GetWidget() const; + // Gets the Widget that most closely contains this View, if any. + virtual Window* GetWindow() const; + // Get the containing RootView virtual RootView* GetRootView(); |