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/native_browser_frame_factory.h" | 74 #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" |
74 #include "chrome/browser/ui/views/frame/top_container_view.h" | 75 #include "chrome/browser/ui/views/frame/top_container_view.h" |
75 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" | 76 #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" |
76 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 77 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
77 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 78 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
78 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 79 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
79 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 80 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
80 #include "chrome/browser/ui/views/password_generation_bubble_view.h" | 81 #include "chrome/browser/ui/views/password_generation_bubble_view.h" |
81 #include "chrome/browser/ui/views/profile_chooser_view.h" | 82 #include "chrome/browser/ui/views/profile_chooser_view.h" |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 frame_(NULL), | 411 frame_(NULL), |
411 top_container_(NULL), | 412 top_container_(NULL), |
412 tabstrip_(NULL), | 413 tabstrip_(NULL), |
413 toolbar_(NULL), | 414 toolbar_(NULL), |
414 window_switcher_button_(NULL), | 415 window_switcher_button_(NULL), |
415 find_bar_host_view_(NULL), | 416 find_bar_host_view_(NULL), |
416 infobar_container_(NULL), | 417 infobar_container_(NULL), |
417 contents_web_view_(NULL), | 418 contents_web_view_(NULL), |
418 devtools_container_(NULL), | 419 devtools_container_(NULL), |
419 contents_container_(NULL), | 420 contents_container_(NULL), |
420 contents_split_(NULL), | |
421 devtools_dock_side_(DEVTOOLS_DOCK_SIDE_BOTTOM), | |
422 devtools_window_(NULL), | 421 devtools_window_(NULL), |
423 initialized_(false), | 422 initialized_(false), |
424 in_process_fullscreen_(false), | 423 in_process_fullscreen_(false), |
425 #if defined(OS_WIN) && !defined(USE_AURA) | 424 #if defined(OS_WIN) && !defined(USE_AURA) |
426 hung_window_detector_(&hung_plugin_action_), | 425 hung_window_detector_(&hung_plugin_action_), |
427 ticker_(0), | 426 ticker_(0), |
428 #endif | 427 #endif |
429 force_location_bar_focus_(false), | 428 force_location_bar_focus_(false), |
430 immersive_mode_controller_(chrome::CreateImmersiveModeController()), | 429 immersive_mode_controller_(chrome::CreateImmersiveModeController()), |
431 #if defined(OS_CHROMEOS) | 430 #if defined(OS_CHROMEOS) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty( | 502 reinterpret_cast<BrowserView*>(widget->GetNativeWindowProperty( |
504 kBrowserViewKey)) : NULL; | 503 kBrowserViewKey)) : NULL; |
505 } | 504 } |
506 | 505 |
507 // static | 506 // static |
508 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { | 507 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { |
509 return static_cast<BrowserView*>(browser->window()); | 508 return static_cast<BrowserView*>(browser->window()); |
510 } | 509 } |
511 | 510 |
512 void BrowserView::InitStatusBubble() { | 511 void BrowserView::InitStatusBubble() { |
513 status_bubble_.reset(new StatusBubbleViews(contents_container_)); | 512 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); |
514 } | 513 } |
515 | 514 |
516 gfx::Rect BrowserView::GetToolbarBounds() const { | 515 gfx::Rect BrowserView::GetToolbarBounds() const { |
517 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 516 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
518 if (toolbar_bounds.IsEmpty()) | 517 if (toolbar_bounds.IsEmpty()) |
519 return toolbar_bounds; | 518 return toolbar_bounds; |
520 // The apparent toolbar edges are outside the "real" toolbar edges. | 519 // The apparent toolbar edges are outside the "real" toolbar edges. |
521 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 520 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
522 return toolbar_bounds; | 521 return toolbar_bounds; |
523 } | 522 } |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 } | 1013 } |
1015 | 1014 |
1016 // When transitioning from animating to not animating we need to make sure the | 1015 // When transitioning from animating to not animating we need to make sure the |
1017 // contents_container_ gets layed out. If we don't do this and the bounds | 1016 // contents_container_ gets layed out. If we don't do this and the bounds |
1018 // haven't changed contents_container_ won't get a Layout out and we'll end up | 1017 // haven't changed contents_container_ won't get a Layout out and we'll end up |
1019 // with a gray rect because the clip wasn't updated. Note that a reentrant | 1018 // with a gray rect because the clip wasn't updated. Note that a reentrant |
1020 // call never needs to do this, because after it returns, the normal call | 1019 // call never needs to do this, because after it returns, the normal call |
1021 // wrapping it will do it. | 1020 // wrapping it will do it. |
1022 if ((call_state == NORMAL) && !is_animating) { | 1021 if ((call_state == NORMAL) && !is_animating) { |
1023 contents_web_view_->InvalidateLayout(); | 1022 contents_web_view_->InvalidateLayout(); |
1024 contents_split_->Layout(); | 1023 contents_container_->Layout(); |
1025 } | 1024 } |
1026 } | 1025 } |
1027 | 1026 |
1028 LocationBar* BrowserView::GetLocationBar() const { | 1027 LocationBar* BrowserView::GetLocationBar() const { |
1029 return GetLocationBarView(); | 1028 return GetLocationBarView(); |
1030 } | 1029 } |
1031 | 1030 |
1032 void BrowserView::SetFocusToLocationBar(bool select_all) { | 1031 void BrowserView::SetFocusToLocationBar(bool select_all) { |
1033 // On Windows, changing focus to the location bar causes the browser | 1032 // On Windows, changing focus to the location bar causes the browser |
1034 // window to become active. This can steal focus if the user has | 1033 // window to become active. This can steal focus if the user has |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 | 1280 |
1282 int BrowserView::GetExtraRenderViewHeight() const { | 1281 int BrowserView::GetExtraRenderViewHeight() const { |
1283 // Currently this is only used on linux. | 1282 // Currently this is only used on linux. |
1284 return 0; | 1283 return 0; |
1285 } | 1284 } |
1286 | 1285 |
1287 void BrowserView::WebContentsFocused(WebContents* contents) { | 1286 void BrowserView::WebContentsFocused(WebContents* contents) { |
1288 if (contents_web_view_->GetWebContents() == contents) | 1287 if (contents_web_view_->GetWebContents() == contents) |
1289 contents_web_view_->OnWebContentsFocused(contents); | 1288 contents_web_view_->OnWebContentsFocused(contents); |
1290 else | 1289 else |
1291 devtools_container_->OnWebContentsFocused(contents); | 1290 devtools_web_view_->OnWebContentsFocused(contents); |
1292 } | 1291 } |
1293 | 1292 |
1294 void BrowserView::ShowWebsiteSettings(Profile* profile, | 1293 void BrowserView::ShowWebsiteSettings(Profile* profile, |
1295 content::WebContents* web_contents, | 1294 content::WebContents* web_contents, |
1296 const GURL& url, | 1295 const GURL& url, |
1297 const content::SSLStatus& ssl) { | 1296 const content::SSLStatus& ssl) { |
1298 WebsiteSettingsPopupView::ShowPopup( | 1297 WebsiteSettingsPopupView::ShowPopup( |
1299 GetLocationBarView()->GetLocationIconView(), profile, | 1298 GetLocationBarView()->GetLocationIconView(), profile, |
1300 web_contents, url, ssl, browser_.get()); | 1299 web_contents, url, ssl, browser_.get()); |
1301 } | 1300 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 // invisible or has no focusable children, it will be automatically | 1742 // invisible or has no focusable children, it will be automatically |
1744 // skipped. | 1743 // skipped. |
1745 panes->push_back(toolbar_); | 1744 panes->push_back(toolbar_); |
1746 if (bookmark_bar_view_.get()) | 1745 if (bookmark_bar_view_.get()) |
1747 panes->push_back(bookmark_bar_view_.get()); | 1746 panes->push_back(bookmark_bar_view_.get()); |
1748 if (infobar_container_) | 1747 if (infobar_container_) |
1749 panes->push_back(infobar_container_); | 1748 panes->push_back(infobar_container_); |
1750 if (download_shelf_.get()) | 1749 if (download_shelf_.get()) |
1751 panes->push_back(download_shelf_.get()); | 1750 panes->push_back(download_shelf_.get()); |
1752 panes->push_back(GetTabContentsContainerView()); | 1751 panes->push_back(GetTabContentsContainerView()); |
1753 if (devtools_container_->visible()) | 1752 if (devtools_web_view_->visible()) |
1754 panes->push_back(devtools_container_); | 1753 panes->push_back(devtools_web_view_); |
1755 } | 1754 } |
1756 | 1755 |
1757 /////////////////////////////////////////////////////////////////////////////// | 1756 /////////////////////////////////////////////////////////////////////////////// |
1758 // BrowserView, views::ClientView overrides: | 1757 // BrowserView, views::ClientView overrides: |
1759 | 1758 |
1760 bool BrowserView::CanClose() { | 1759 bool BrowserView::CanClose() { |
1761 // You cannot close a frame for which there is an active originating drag | 1760 // You cannot close a frame for which there is an active originating drag |
1762 // session. | 1761 // session. |
1763 if (tabstrip_ && !tabstrip_->IsTabStripCloseable()) | 1762 if (tabstrip_ && !tabstrip_->IsTabStripCloseable()) |
1764 return false; | 1763 return false; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 LoadAccelerators(); | 1943 LoadAccelerators(); |
1945 | 1944 |
1946 infobar_container_ = new InfoBarContainerView(this); | 1945 infobar_container_ = new InfoBarContainerView(this); |
1947 AddChildView(infobar_container_); | 1946 AddChildView(infobar_container_); |
1948 | 1947 |
1949 contents_web_view_ = new views::WebView(browser_->profile()); | 1948 contents_web_view_ = new views::WebView(browser_->profile()); |
1950 contents_web_view_->set_id(VIEW_ID_TAB_CONTAINER); | 1949 contents_web_view_->set_id(VIEW_ID_TAB_CONTAINER); |
1951 contents_web_view_->SetEmbedFullscreenWidgetMode( | 1950 contents_web_view_->SetEmbedFullscreenWidgetMode( |
1952 implicit_cast<content::WebContentsDelegate*>(browser_.get())-> | 1951 implicit_cast<content::WebContentsDelegate*>(browser_.get())-> |
1953 EmbedsFullscreenWidget()); | 1952 EmbedsFullscreenWidget()); |
1954 contents_container_ = new ContentsContainer(contents_web_view_); | |
1955 | 1953 |
1956 SkColor bg_color = GetWidget()->GetThemeProvider()-> | 1954 devtools_web_view_ = new views::WebView(browser_->profile()); |
1957 GetColor(ThemeProperties::COLOR_TOOLBAR); | 1955 devtools_web_view_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); |
| 1956 devtools_web_view_->SetVisible(false); |
1958 | 1957 |
1959 devtools_container_ = new views::WebView(browser_->profile()); | 1958 devtools_container_ = new DevToolsContainer( |
1960 devtools_container_->set_id(VIEW_ID_DEV_TOOLS_DOCKED); | 1959 contents_web_view_, devtools_web_view_); |
1961 devtools_container_->SetVisible(false); | |
1962 | 1960 |
| 1961 contents_container_ = new ContentsContainer(devtools_container_); |
1963 views::View* contents_container_view = contents_container_; | 1962 views::View* contents_container_view = contents_container_; |
1964 | 1963 AddChildView(contents_container_view); |
1965 contents_split_ = new views::SingleSplitView( | 1964 set_contents_view(contents_container_view); |
1966 contents_container_view, | |
1967 devtools_container_, | |
1968 views::SingleSplitView::VERTICAL_SPLIT, | |
1969 this); | |
1970 contents_split_->set_id(VIEW_ID_CONTENTS_SPLIT); | |
1971 contents_split_->SetAccessibleName( | |
1972 l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)); | |
1973 contents_split_->set_background( | |
1974 views::Background::CreateSolidBackground(bg_color)); | |
1975 AddChildView(contents_split_); | |
1976 set_contents_view(contents_split_); | |
1977 | 1965 |
1978 InitStatusBubble(); | 1966 InitStatusBubble(); |
1979 | 1967 |
1980 // Top container holds tab strip and toolbar and lives at the front of the | 1968 // Top container holds tab strip and toolbar and lives at the front of the |
1981 // view hierarchy. | 1969 // view hierarchy. |
1982 top_container_ = new TopContainerView(this); | 1970 top_container_ = new TopContainerView(this); |
1983 AddChildView(top_container_); | 1971 AddChildView(top_container_); |
1984 | 1972 |
1985 // TabStrip takes ownership of the controller. | 1973 // TabStrip takes ownership of the controller. |
1986 BrowserTabStripController* tabstrip_controller = | 1974 BrowserTabStripController* tabstrip_controller = |
(...skipping 18 matching lines...) Expand all Loading... |
2005 immersive_mode_controller_->Init(this); | 1993 immersive_mode_controller_->Init(this); |
2006 | 1994 |
2007 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; | 1995 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; |
2008 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), | 1996 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), |
2009 browser(), | 1997 browser(), |
2010 this, | 1998 this, |
2011 top_container_, | 1999 top_container_, |
2012 tabstrip_, | 2000 tabstrip_, |
2013 toolbar_, | 2001 toolbar_, |
2014 infobar_container_, | 2002 infobar_container_, |
2015 contents_split_, | |
2016 contents_container_, | 2003 contents_container_, |
2017 immersive_mode_controller_.get()); | 2004 immersive_mode_controller_.get()); |
2018 SetLayoutManager(browser_view_layout); | 2005 SetLayoutManager(browser_view_layout); |
2019 | 2006 |
2020 #if defined(OS_WIN) && !defined(USE_AURA) | 2007 #if defined(OS_WIN) && !defined(USE_AURA) |
2021 // Create a custom JumpList and add it to an observer of TabRestoreService | 2008 // Create a custom JumpList and add it to an observer of TabRestoreService |
2022 // so we can update the custom JumpList when a tab is added or removed. | 2009 // so we can update the custom JumpList when a tab is added or removed. |
2023 if (JumpList::Enabled()) { | 2010 if (JumpList::Enabled()) { |
2024 load_complete_listener_.reset(new LoadCompleteListener(this)); | 2011 load_complete_listener_.reset(new LoadCompleteListener(this)); |
2025 } | 2012 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { | 2132 bool BrowserView::MaybeShowInfoBar(WebContents* contents) { |
2146 // TODO(beng): Remove this function once the interface between | 2133 // TODO(beng): Remove this function once the interface between |
2147 // InfoBarContainer, DownloadShelfView and WebContents and this | 2134 // InfoBarContainer, DownloadShelfView and WebContents and this |
2148 // view is sorted out. | 2135 // view is sorted out. |
2149 return true; | 2136 return true; |
2150 } | 2137 } |
2151 | 2138 |
2152 void BrowserView::UpdateDevToolsForContents(WebContents* web_contents) { | 2139 void BrowserView::UpdateDevToolsForContents(WebContents* web_contents) { |
2153 DevToolsWindow* new_devtools_window = web_contents ? | 2140 DevToolsWindow* new_devtools_window = web_contents ? |
2154 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents) : NULL; | 2141 DevToolsWindow::GetDockedInstanceForInspectedTab(web_contents) : NULL; |
2155 // Fast return in case of the same window having same orientation. | |
2156 if (devtools_window_ == new_devtools_window) { | |
2157 if (!new_devtools_window || | |
2158 (new_devtools_window->dock_side() == devtools_dock_side_)) { | |
2159 return; | |
2160 } | |
2161 } | |
2162 | 2142 |
2163 // Replace tab contents. | 2143 // Replace tab contents. |
2164 if (devtools_window_ != new_devtools_window) { | 2144 if (devtools_window_ != new_devtools_window) { |
2165 devtools_container_->SetWebContents( | 2145 devtools_web_view_->SetWebContents( |
2166 new_devtools_window ? new_devtools_window->web_contents() : NULL); | 2146 new_devtools_window ? new_devtools_window->web_contents() : NULL); |
2167 } | 2147 } |
2168 | 2148 |
2169 // Store last used position. | 2149 if (!devtools_window_ && new_devtools_window && |
2170 if (devtools_window_) { | 2150 !devtools_focus_tracker_.get()) { |
2171 int split_size = contents_split_->GetDividerSize(); | 2151 // Install devtools focus tracker when dev tools window is shown for the |
2172 if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT) { | 2152 // first time. |
2173 devtools_window_->SetWidth(contents_split_->width() - | 2153 devtools_focus_tracker_.reset( |
2174 split_size - contents_split_->divider_offset()); | 2154 new views::ExternalFocusTracker(devtools_web_view_, |
2175 } else if (devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_BOTTOM) { | 2155 GetFocusManager())); |
2176 devtools_window_->SetHeight(contents_split_->height() - | |
2177 split_size - contents_split_->divider_offset()); | |
2178 } | |
2179 } | 2156 } |
2180 | 2157 |
2181 // Show / hide container if necessary. Changing dock orientation is | 2158 // Restore focus to the last focused view when hiding devtools window. |
2182 // hide + show. | 2159 if (devtools_window_ && !new_devtools_window && |
2183 bool should_hide = devtools_window_ && (!new_devtools_window || | 2160 devtools_focus_tracker_.get()) { |
2184 devtools_dock_side_ != new_devtools_window->dock_side()); | 2161 devtools_focus_tracker_->FocusLastFocusedExternalView(); |
2185 bool should_show = new_devtools_window && (!devtools_window_ || should_hide); | 2162 devtools_focus_tracker_.reset(); |
2186 | 2163 } |
2187 if (should_hide) | |
2188 HideDevToolsContainer(); | |
2189 | 2164 |
2190 devtools_window_ = new_devtools_window; | 2165 devtools_window_ = new_devtools_window; |
2191 | 2166 if (devtools_window_) { |
2192 if (should_show) { | 2167 devtools_web_view_->SetPreferredSize(devtools_window_->GetMinimumSize()); |
2193 devtools_dock_side_ = new_devtools_window->dock_side(); | 2168 devtools_web_view_->SetVisible(true); |
2194 ShowDevToolsContainer(); | 2169 devtools_container_->SetContentsViewOffsets( |
2195 } else if (new_devtools_window) { | 2170 devtools_window_->GetTopLeftContentsOffset(), |
2196 UpdateDevToolsSplitPosition(); | 2171 devtools_window_->GetBottomRightContentsOffset()); |
2197 contents_split_->Layout(); | 2172 } else { |
| 2173 devtools_web_view_->SetVisible(false); |
| 2174 devtools_container_->SetContentsViewOffsets( |
| 2175 gfx::Size(), gfx::Size()); |
2198 } | 2176 } |
2199 } | 2177 } |
2200 | 2178 |
2201 void BrowserView::ShowDevToolsContainer() { | |
2202 if (!devtools_focus_tracker_.get()) { | |
2203 // Install devtools focus tracker when dev tools window is shown for the | |
2204 // first time. | |
2205 devtools_focus_tracker_.reset( | |
2206 new views::ExternalFocusTracker(devtools_container_, | |
2207 GetFocusManager())); | |
2208 } | |
2209 | |
2210 gfx::Size min_devtools_size(devtools_window_->GetMinimumWidth(), | |
2211 devtools_window_->GetMinimumHeight()); | |
2212 devtools_container_->SetPreferredSize(min_devtools_size); | |
2213 | |
2214 devtools_container_->SetVisible(true); | |
2215 devtools_dock_side_ = devtools_window_->dock_side(); | |
2216 bool dock_to_right = devtools_dock_side_ == DEVTOOLS_DOCK_SIDE_RIGHT; | |
2217 contents_split_->set_orientation( | |
2218 dock_to_right ? views::SingleSplitView::HORIZONTAL_SPLIT | |
2219 : views::SingleSplitView::VERTICAL_SPLIT); | |
2220 UpdateDevToolsSplitPosition(); | |
2221 contents_split_->InvalidateLayout(); | |
2222 Layout(); | |
2223 } | |
2224 | |
2225 void BrowserView::HideDevToolsContainer() { | |
2226 // Restore focus to the last focused view when hiding devtools window. | |
2227 devtools_focus_tracker_->FocusLastFocusedExternalView(); | |
2228 devtools_container_->SetVisible(false); | |
2229 contents_split_->InvalidateLayout(); | |
2230 Layout(); | |
2231 } | |
2232 | |
2233 void BrowserView::UpdateDevToolsSplitPosition() { | |
2234 contents_split_->set_resize_disabled( | |
2235 devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_MINIMIZED); | |
2236 int split_size = contents_split_->GetDividerSize(); | |
2237 if (devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_RIGHT) { | |
2238 int split_offset = contents_split_->width() - split_size - | |
2239 devtools_window_->GetWidth(contents_split_->width()); | |
2240 contents_split_->set_divider_offset(split_offset); | |
2241 } else { | |
2242 int height = devtools_window_->dock_side() == DEVTOOLS_DOCK_SIDE_MINIMIZED ? | |
2243 devtools_window_->GetMinimizedHeight() : | |
2244 devtools_window_->GetHeight(contents_split_->height()); | |
2245 int split_offset = contents_split_->height() - split_size - height; | |
2246 contents_split_->set_divider_offset(split_offset); | |
2247 } | |
2248 } | |
2249 | |
2250 void BrowserView::UpdateUIForContents(WebContents* contents) { | 2179 void BrowserView::UpdateUIForContents(WebContents* contents) { |
2251 bool needs_layout = MaybeShowBookmarkBar(contents); | 2180 bool needs_layout = MaybeShowBookmarkBar(contents); |
2252 // TODO(jamescook): This function always returns true. Remove it and figure | 2181 // TODO(jamescook): This function always returns true. Remove it and figure |
2253 // out when layout is actually required. | 2182 // out when layout is actually required. |
2254 needs_layout |= MaybeShowInfoBar(contents); | 2183 needs_layout |= MaybeShowInfoBar(contents); |
2255 if (needs_layout) | 2184 if (needs_layout) |
2256 Layout(); | 2185 Layout(); |
2257 } | 2186 } |
2258 | 2187 |
2259 void BrowserView::ProcessFullscreen(bool fullscreen, | 2188 void BrowserView::ProcessFullscreen(bool fullscreen, |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2597 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2669 gfx::Point icon_bottom( | 2598 gfx::Point icon_bottom( |
2670 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2599 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2671 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2600 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2672 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2601 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2673 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2602 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2674 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2603 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2675 } | 2604 } |
2676 return top_arrow_height; | 2605 return top_arrow_height; |
2677 } | 2606 } |
OLD | NEW |