OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/ui/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 62 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
63 #include "chrome/browser/ui/views/avatar_menu_button.h" | 63 #include "chrome/browser/ui/views/avatar_menu_button.h" |
64 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" | 64 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
65 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" | 65 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
66 #include "chrome/browser/ui/views/browser_dialogs.h" | 66 #include "chrome/browser/ui/views/browser_dialogs.h" |
67 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" | 67 #include "chrome/browser/ui/views/download/download_in_progress_dialog_view.h" |
68 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 68 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
69 #include "chrome/browser/ui/views/frame/browser_view_layout.h" | 69 #include "chrome/browser/ui/views/frame/browser_view_layout.h" |
70 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" | 70 #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" |
71 #include "chrome/browser/ui/views/frame/contents_container.h" | 71 #include "chrome/browser/ui/views/frame/contents_container.h" |
| 72 #include "chrome/browser/ui/views/frame/devtools_container.h" |
72 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 73 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
73 #include "chrome/browser/ui/views/frame/top_container_view.h" | 74 #include "chrome/browser/ui/views/frame/top_container_view.h" |
74 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 75 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
75 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 76 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
76 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 77 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
77 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 78 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
78 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 79 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
79 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 80 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
80 #include "chrome/browser/ui/views/profile_chooser_view.h" | 81 #include "chrome/browser/ui/views/profile_chooser_view.h" |
81 #include "chrome/browser/ui/views/status_bubble_views.h" | 82 #include "chrome/browser/ui/views/status_bubble_views.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 frame_(NULL), | 394 frame_(NULL), |
394 top_container_(NULL), | 395 top_container_(NULL), |
395 tabstrip_(NULL), | 396 tabstrip_(NULL), |
396 toolbar_(NULL), | 397 toolbar_(NULL), |
397 window_switcher_button_(NULL), | 398 window_switcher_button_(NULL), |
398 find_bar_host_view_(NULL), | 399 find_bar_host_view_(NULL), |
399 infobar_container_(NULL), | 400 infobar_container_(NULL), |
400 contents_web_view_(NULL), | 401 contents_web_view_(NULL), |
401 devtools_container_(NULL), | 402 devtools_container_(NULL), |
402 contents_container_(NULL), | 403 contents_container_(NULL), |
403 contents_split_(NULL), | |
404 devtools_dock_side_(DEVTOOLS_DOCK_SIDE_BOTTOM), | |
405 devtools_window_(NULL), | 404 devtools_window_(NULL), |
406 initialized_(false), | 405 initialized_(false), |
407 in_process_fullscreen_(false), | 406 in_process_fullscreen_(false), |
408 #if defined(OS_WIN) && !defined(USE_AURA) | 407 #if defined(OS_WIN) && !defined(USE_AURA) |
409 hung_window_detector_(&hung_plugin_action_), | 408 hung_window_detector_(&hung_plugin_action_), |
410 ticker_(0), | 409 ticker_(0), |
411 #endif | 410 #endif |
412 force_location_bar_focus_(false), | 411 force_location_bar_focus_(false), |
413 immersive_mode_controller_(chrome::CreateImmersiveModeController()), | 412 immersive_mode_controller_(chrome::CreateImmersiveModeController()), |
414 #if defined(OS_CHROMEOS) | 413 #if defined(OS_CHROMEOS) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty( | 485 reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty( |
487 kBrowserViewKey)) : NULL; | 486 kBrowserViewKey)) : NULL; |
488 } | 487 } |
489 | 488 |
490 // static | 489 // static |
491 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { | 490 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { |
492 return static_cast<BrowserView*>(browser->window()); | 491 return static_cast<BrowserView*>(browser->window()); |
493 } | 492 } |
494 | 493 |
495 void BrowserView::InitStatusBubble() { | 494 void BrowserView::InitStatusBubble() { |
496 status_bubble_.reset(new StatusBubbleViews(contents_container_)); | 495 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); |
497 } | 496 } |
498 | 497 |
499 gfx::Rect BrowserView::GetToolbarBounds() const { | 498 gfx::Rect BrowserView::GetToolbarBounds() const { |
500 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 499 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
501 if (toolbar_bounds.IsEmpty()) | 500 if (toolbar_bounds.IsEmpty()) |
502 return toolbar_bounds; | 501 return toolbar_bounds; |
503 // The apparent toolbar edges are outside the "real" toolbar edges. | 502 // The apparent toolbar edges are outside the "real" toolbar edges. |
504 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 503 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
505 return toolbar_bounds; | 504 return toolbar_bounds; |
506 } | 505 } |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 } | 1000 } |
1002 | 1001 |
1003 // When transitioning from animating to not animating we need to make sure the | 1002 // When transitioning from animating to not animating we need to make sure the |
1004 // contents_container_ gets layed out. If we don't do this and the bounds | 1003 // contents_container_ gets layed out. If we don't do this and the bounds |
1005 // haven't changed contents_container_ won't get a Layout out and we'll end up | 1004 // haven't changed contents_container_ won't get a Layout out and we'll end up |
1006 // with a gray rect because the clip wasn't updated. Note that a reentrant | 1005 // with a gray rect because the clip wasn't updated. Note that a reentrant |
1007 // call never needs to do this, because after it returns, the normal call | 1006 // call never needs to do this, because after it returns, the normal call |
1008 // wrapping it will do it. | 1007 // wrapping it will do it. |
1009 if ((call_state == NORMAL) && !is_animating) { | 1008 if ((call_state == NORMAL) && !is_animating) { |
1010 contents_web_view_->InvalidateLayout(); | 1009 contents_web_view_->InvalidateLayout(); |
1011 contents_split_->Layout(); | 1010 contents_container_->Layout(); |
1012 } | 1011 } |
1013 } | 1012 } |
1014 | 1013 |
1015 LocationBar* BrowserView::GetLocationBar() const { | 1014 LocationBar* BrowserView::GetLocationBar() const { |
1016 return GetLocationBarView(); | 1015 return GetLocationBarView(); |
1017 } | 1016 } |
1018 | 1017 |
1019 void BrowserView::SetFocusToLocationBar(bool select_all) { | 1018 void BrowserView::SetFocusToLocationBar(bool select_all) { |
1020 // On Windows, changing focus to the location bar causes the browser | 1019 // On Windows, changing focus to the location bar causes the browser |
1021 // window to become active. This can steal focus if the user has | 1020 // window to become active. This can steal focus if the user has |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1265 |
1267 int BrowserView::GetExtraRenderViewHeight() const { | 1266 int BrowserView::GetExtraRenderViewHeight() const { |
1268 // Currently this is only used on linux. | 1267 // Currently this is only used on linux. |
1269 return 0; | 1268 return 0; |
1270 } | 1269 } |
1271 | 1270 |
1272 void BrowserView::WebContentsFocused(WebContents* contents) { | 1271 void BrowserView::WebContentsFocused(WebContents* contents) { |
1273 if (contents_web_view_->GetWebContents() == contents) | 1272 if (contents_web_view_->GetWebContents() == contents) |
1274 contents_web_view_->OnWebContentsFocused(contents); | 1273 contents_web_view_->OnWebContentsFocused(contents); |
1275 else | 1274 else |
1276 devtools_container_->OnWebContentsFocused(contents); | 1275 devtools_web_view_->OnWebContentsFocused(contents); |
1277 } | 1276 } |
1278 | 1277 |
1279 void BrowserView::ShowWebsiteSettings(Profile* profile, | 1278 void BrowserView::ShowWebsiteSettings(Profile* profile, |
1280 content::WebContents* web_contents, | 1279 content::WebContents* web_contents, |
1281 const GURL& url, | 1280 const GURL& url, |
1282 const content::SSLStatus& ssl) { | 1281 const content::SSLStatus& ssl) { |
1283 WebsiteSettingsPopupView::ShowPopup( | 1282 WebsiteSettingsPopupView::ShowPopup( |
1284 GetLocationBarView()->GetLocationIconView(), profile, | 1283 GetLocationBarView()->GetLocationIconView(), profile, |
1285 web_contents, url, ssl, browser_.get()); | 1284 web_contents, url, ssl, browser_.get()); |
1286 } | 1285 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 // invisible or has no focusable children, it will be automatically | 1727 // invisible or has no focusable children, it will be automatically |
1729 // skipped. | 1728 // skipped. |
1730 panes->push_back(toolbar_); | 1729 panes->push_back(toolbar_); |
1731 if (bookmark_bar_view_.get()) | 1730 if (bookmark_bar_view_.get()) |
1732 panes->push_back(bookmark_bar_view_.get()); | 1731 panes->push_back(bookmark_bar_view_.get()); |
1733 if (infobar_container_) | 1732 if (infobar_container_) |
1734 panes->push_back(infobar_container_); | 1733 panes->push_back(infobar_container_); |
1735 if (download_shelf_.get()) | 1734 if (download_shelf_.get()) |
1736 panes->push_back(download_shelf_.get()); | 1735 panes->push_back(download_shelf_.get()); |
1737 panes->push_back(GetTabContentsContainerView()); | 1736 panes->push_back(GetTabContentsContainerView()); |
1738 if (devtools_container_->visible()) | 1737 if (devtools_web_view_->visible()) |
1739 panes->push_back(devtools_container_); | 1738 panes->push_back(devtools_web_view_); |
1740 } | 1739 } |
1741 | 1740 |
1742 /////////////////////////////////////////////////////////////////////////////// | 1741 /////////////////////////////////////////////////////////////////////////////// |
1743 // BrowserView, views::ClientView overrides: | 1742 // BrowserView, views::ClientView overrides: |
1744 | 1743 |
1745 bool BrowserView::CanClose() { | 1744 bool BrowserView::CanClose() { |
1746 // You cannot close a frame for which there is an active originating drag | 1745 // You cannot close a frame for which there is an active originating drag |
1747 // session. | 1746 // session. |
1748 if (tabstrip_ && !tabstrip_->IsTabStripCloseable()) | 1747 if (tabstrip_ && !tabstrip_->IsTabStripCloseable()) |
1749 return false; | 1748 return false; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1929 LoadAccelerators(); | 1928 LoadAccelerators(); |
1930 | 1929 |
1931 infobar_container_ = new InfoBarContainerView(this); | 1930 infobar_container_ = new InfoBarContainerView(this); |
1932 AddChildView(infobar_container_); | 1931 AddChildView(infobar_container_); |
1933 | 1932 |
1934 contents_web_view_ = new views::WebView(browser_->profile()); | 1933 contents_web_view_ = new views::WebView(browser_->profile()); |
1935 contents_web_view_->set_id(VIEW_ID_TAB_CONTAINER); | 1934 contents_web_view_->set_id(VIEW_ID_TAB_CONTAINER); |
1936 contents_web_view_->SetEmbedFullscreenWidgetMode( | 1935 contents_web_view_->SetEmbedFullscreenWidgetMode( |
1937 implicit_cast<content::WebContentsDelegate*>(browser_.get())-> | 1936 implicit_cast<content::WebContentsDelegate*>(browser_.get())-> |
1938 EmbedsFullscreenWidget()); | 1937 EmbedsFullscreenWidget()); |
1939 contents_container_ = new ContentsContainer(contents_web_view_); | |
1940 | 1938 |
1941 SkColor bg_color = GetWidget()->GetThemeProvider()-> | 1939 devtools_web_view_ = new views::WebView(browser_->profile()); |
1942 GetColor(ThemeProperties::COLOR_TOOLBAR); | 1940 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
| 1941 devtools_web_view_->SetVisible(false); |
1943 | 1942 |
1944 devtools_container_ = new views::WebView(browser_->profile()); | 1943 devtools_container_ = new DevToolsContainer( |
1945 devtools_container_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 1944 contents_web_view_, devtools_web_view_); |
1946 devtools_container_->SetVisible(false); | |
1947 | 1945 |
| 1946 contents_container_ = new ContentsContainer(devtools_container_); |
1948 views::View* contents_container_view = contents_container_; | 1947 views::View* contents_container_view = contents_container_; |
1949 | 1948 AddChildView(contents_container_view); |
1950 contents_split_ = new views::SingleSplitView( | 1949 set_contents_view(contents_container_view); |
1951 contents_container_view, | |
1952 devtools_container_, | |
1953 views::SingleSplitView::VERTICAL_SPLIT, | |
1954 this); | |
1955 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); | |
1956 contents_split_->SetAccessibleName( | |
1957 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); | |
1958 contents_split_->set_background( | |
1959 views::Background::CreateSolidBackground(bg_color)); | |
1960 AddChildView(contents_split_); | |
1961 set_contents_view(contents_split_); | |
1962 | 1950 |
1963 InitStatusBubble(); | 1951 InitStatusBubble(); |
1964 | 1952 |
1965 // Top container holds tab strip and toolbar and lives at the front of the | 1953 // Top container holds tab strip and toolbar and lives at the front of the |
1966 // view hierarchy. | 1954 // view hierarchy. |
1967 top_container_ = new TopContainerView(this); | 1955 top_container_ = new TopContainerView(this); |
1968 AddChildView(top_container_); | 1956 AddChildView(top_container_); |
1969 | 1957 |
1970 // TabStrip takes ownership of the controller. | 1958 // TabStrip takes ownership of the controller. |
1971 BrowserTabStripController* tabstrip_controller = | 1959 BrowserTabStripController* tabstrip_controller = |
(...skipping 18 matching lines...) Expand all Loading... |
1990 immersive_mode_controller_->Init(this); | 1978 immersive_mode_controller_->Init(this); |
1991 | 1979 |
1992 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; | 1980 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; |
1993 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), | 1981 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), |
1994 browser(), | 1982 browser(), |
1995 this, | 1983 this, |
1996 top_container_, | 1984 top_container_, |
1997 tabstrip_, | 1985 tabstrip_, |
1998 toolbar_, | 1986 toolbar_, |
1999 infobar_container_, | 1987 infobar_container_, |
2000 contents_split_, | |
2001 contents_container_, | 1988 contents_container_, |
2002 immersive_mode_controller_.get()); | 1989 immersive_mode_controller_.get()); |
2003 SetLayoutManager(browser_view_layout); | 1990 SetLayoutManager(browser_view_layout); |
2004 | 1991 |
2005 #if defined(OS_WIN) && !defined(USE_AURA) | 1992 #if defined(OS_WIN) && !defined(USE_AURA) |
2006 // Create a custom JumpList and add it to an observer of TabRestoreService | 1993 // Create a custom JumpList and add it to an observer of TabRestoreService |
2007 // so we can update the custom JumpList when a tab is added or removed. | 1994 // so we can update the custom JumpList when a tab is added or removed. |
2008 if (JumpList::Enabled()) { | 1995 if (JumpList::Enabled()) { |
2009 load_complete_listener_.reset(new LoadCompleteListener(this)); | 1996 load_complete_listener_.reset(new LoadCompleteListener(this)); |
2010 } | 1997 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { | 2118 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { |
2132 // TODO(beng): Remove this function once the interface between | 2119 // TODO(beng): Remove this function once the interface between |
2133 // InfoBarContainer, DownloadShelfView and WebContents and this | 2120 // InfoBarContainer, DownloadShelfView and WebContents and this |
2134 // view is sorted out. | 2121 // view is sorted out. |
2135 return true; | 2122 return true; |
2136 } | 2123 } |
2137 | 2124 |
2138 void BrowserView::UpdateDevToolsForContents(WebContents* web_contents) { | 2125 void BrowserView::UpdateDevToolsForContents(WebContents* web_contents) { |
2139 DevToolsWindow* new_devtools_window = web_contents ? | 2126 DevToolsWindow* new_devtools_window = web_contents ? |
2140 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents) : NULL; | 2127 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents) : NULL; |
2141 // Fast return in case of the same window having same orientation. | |
2142 if (devtools_window_ == new_devtools_window) { | |
2143 if (!new_devtools_window || | |
2144 (new_devtools_window->dock_side() == devtools_dock_side_)) { | |
2145 return; | |
2146 } | |
2147 } | |
2148 | 2128 |
2149 // Replace tab contents. | 2129 // Replace tab contents. |
2150 if (devtools_window_ != new_devtools_window) { | 2130 if (devtools_window_ != new_devtools_window) { |
2151 devtools_container_->SetWebContents( | 2131 devtools_web_view_->SetWebContents( |
2152 new_devtools_window ? new_devtools_window->web_contents() : NULL); | 2132 new_devtools_window ? new_devtools_window->web_contents() : NULL); |
2153 } | 2133 } |
2154 | 2134 |
2155 // Store last used position. | 2135 if (!devtools_window_ && new_devtools_window && |
2156 if (devtools_window_) { | 2136 !devtools_focus_tracker_.get()) { |
2157 int split_size = contents_split_->GetDividerSize(); | 2137 // Install devtools focus tracker when dev tools window is shown for the |
2158 if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { | 2138 // first time. |
2159 devtools_window_->SetWidth(contents_split_->width() - | 2139 devtools_focus_tracker_.reset( |
2160 split_size - contents_split_->divider_offset()); | 2140 new views::ExternalFocusTracker(devtools_web_view_, |
2161 } else if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_BOTTOM) { | 2141 GetFocusManager())); |
2162 devtools_window_->SetHeight(contents_split_->height() - | |
2163 split_size - contents_split_->divider_offset()); | |
2164 } | |
2165 } | 2142 } |
2166 | 2143 |
2167 // Show / hide container if necessary. Changing dock orientation is | 2144 // Restore focus to the last focused view when hiding devtools window. |
2168 // hide + show. | 2145 if (devtools_window_ && !new_devtools_window && |
2169 bool should_hide = devtools_window_ && (!new_devtools_window || | 2146 devtools_focus_tracker_.get()) { |
2170 devtools_dock_side_ != new_devtools_window->dock_side()); | 2147 devtools_focus_tracker_->FocusLastFocusedExternalView(); |
2171 bool should_show = new_devtools_window && (!devtools_window_ || should_hide); | 2148 devtools_focus_tracker_.reset(); |
2172 | 2149 } |
2173 if (should_hide) | |
2174 HideDevToolsContainer(); | |
2175 | 2150 |
2176 devtools_window_ = new_devtools_window; | 2151 devtools_window_ = new_devtools_window; |
2177 | 2152 if (devtools_window_) { |
2178 if (should_show) { | 2153 devtools_web_view_->SetPreferredSize(devtools_window_->GetMinimumSize()); |
2179 devtools_dock_side_ = new_devtools_window->dock_side(); | 2154 devtools_web_view_->SetVisible(true); |
2180 ShowDevToolsContainer(); | 2155 devtools_container_->SetContentsViewOffsets( |
2181 } else if (new_devtools_window) { | 2156 devtools_window_->GetTopLeftContentsOffset(), |
2182 UpdateDevToolsSplitPosition(); | 2157 devtools_window_->GetBottomRightContentsOffset()); |
2183 contents_split_->Layout(); | 2158 } else { |
| 2159 devtools_web_view_->SetVisible(false); |
| 2160 devtools_container_->SetContentsViewOffsets( |
| 2161 gfx::Size(), gfx::Size()); |
2184 } | 2162 } |
2185 } | 2163 } |
2186 | 2164 |
2187 void BrowserView::ShowDevToolsContainer() { | |
2188 if (!devtools_focus_tracker_.get()) { | |
2189 // Install devtools focus tracker when dev tools window is shown for the | |
2190 // first time. | |
2191 devtools_focus_tracker_.reset( | |
2192 new views::ExternalFocusTracker(devtools_container_, | |
2193 GetFocusManager())); | |
2194 } | |
2195 | |
2196 gfx::Size min_devtools_size(devtools_window_->GetMinimumWidth(), | |
2197 devtools_window_->GetMinimumHeight()); | |
2198 devtools_container_->SetPreferredSize(min_devtools_size); | |
2199 | |
2200 devtools_container_->SetVisible(true); | |
2201 devtools_dock_side_ = devtools_window_->dock_side(); | |
2202 bool dock_to_right = devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT; | |
2203 contents_split_->set_orientation( | |
2204 dock_to_right ? views::SingleSplitView::HORIZONTAL_SPLIT | |
2205 : views::SingleSplitView::VERTICAL_SPLIT); | |
2206 UpdateDevToolsSplitPosition(); | |
2207 contents_split_->InvalidateLayout(); | |
2208 Layout(); | |
2209 } | |
2210 | |
2211 void BrowserView::HideDevToolsContainer() { | |
2212 // Restore focus to the last focused view when hiding devtools window. | |
2213 devtools_focus_tracker_->FocusLastFocusedExternalView(); | |
2214 devtools_container_->SetVisible(false); | |
2215 contents_split_->InvalidateLayout(); | |
2216 Layout(); | |
2217 } | |
2218 | |
2219 void BrowserView::UpdateDevToolsSplitPosition() { | |
2220 contents_split_->set_resize_disabled( | |
2221 devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_MINIMIZED); | |
2222 int split_size = contents_split_->GetDividerSize(); | |
2223 if (devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_RIGHT) { | |
2224 int split_offset = contents_split_->width() - split_size - | |
2225 devtools_window_->GetWidth(contents_split_->width()); | |
2226 contents_split_->set_divider_offset(split_offset); | |
2227 } else { | |
2228 int height = devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_MINIMIZED ? | |
2229 devtools_window_->GetMinimizedHeight() : | |
2230 devtools_window_->GetHeight(contents_split_->height()); | |
2231 int split_offset = contents_split_->height() - split_size - height; | |
2232 contents_split_->set_divider_offset(split_offset); | |
2233 } | |
2234 } | |
2235 | |
2236 void BrowserView::UpdateUIForContents(WebContents* contents) { | 2165 void BrowserView::UpdateUIForContents(WebContents* contents) { |
2237 bool needs_layout = MaybeShowBookmarkBar(contents); | 2166 bool needs_layout = MaybeShowBookmarkBar(contents); |
2238 // TODO(jamescook): This function always returns true. Remove it and figure | 2167 // TODO(jamescook): This function always returns true. Remove it and figure |
2239 // out when layout is actually required. | 2168 // out when layout is actually required. |
2240 needs_layout |= MaybeShowInfoBar(contents); | 2169 needs_layout |= MaybeShowInfoBar(contents); |
2241 if (needs_layout) | 2170 if (needs_layout) |
2242 Layout(); | 2171 Layout(); |
2243 } | 2172 } |
2244 | 2173 |
2245 void BrowserView::ProcessFullscreen(bool fullscreen, | 2174 void BrowserView::ProcessFullscreen(bool fullscreen, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2643 !GetLocationBar()->GetLocationEntry()->model()->popup_model()->IsOpen()) { | 2572 !GetLocationBar()->GetLocationEntry()->model()->popup_model()->IsOpen()) { |
2644 gfx::Point icon_bottom( | 2573 gfx::Point icon_bottom( |
2645 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2574 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2646 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2575 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2647 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2576 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2648 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2577 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2649 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2578 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2650 } | 2579 } |
2651 return top_arrow_height; | 2580 return top_arrow_height; |
2652 } | 2581 } |
OLD | NEW |