| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 public: | 241 public: |
| 242 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) | 242 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) |
| 243 : browser_view_(browser_view) {} | 243 : browser_view_(browser_view) {} |
| 244 virtual ~BrowserViewLayoutDelegateImpl() {} | 244 virtual ~BrowserViewLayoutDelegateImpl() {} |
| 245 | 245 |
| 246 // BrowserViewLayoutDelegate overrides: | 246 // BrowserViewLayoutDelegate overrides: |
| 247 virtual views::View* GetContentsWebView() const OVERRIDE { | 247 virtual views::View* GetContentsWebView() const OVERRIDE { |
| 248 return browser_view_->contents_web_view_; | 248 return browser_view_->contents_web_view_; |
| 249 } | 249 } |
| 250 | 250 |
| 251 virtual views::View* GetWindowSwitcherButton() const OVERRIDE { | |
| 252 return browser_view_->window_switcher_button(); | |
| 253 } | |
| 254 | |
| 255 virtual bool DownloadShelfNeedsLayout() const OVERRIDE { | 251 virtual bool DownloadShelfNeedsLayout() const OVERRIDE { |
| 256 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); | 252 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); |
| 257 // Re-layout the shelf either if it is visible or if its close animation | 253 // Re-layout the shelf either if it is visible or if its close animation |
| 258 // is currently running. | 254 // is currently running. |
| 259 return download_shelf && | 255 return download_shelf && |
| 260 (download_shelf->IsShowing() || download_shelf->IsClosing()); | 256 (download_shelf->IsShowing() || download_shelf->IsClosing()); |
| 261 } | 257 } |
| 262 | 258 |
| 263 virtual bool IsTabStripVisible() const OVERRIDE { | 259 virtual bool IsTabStripVisible() const OVERRIDE { |
| 264 return browser_view_->IsTabStripVisible(); | 260 return browser_view_->IsTabStripVisible(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 // BrowserView, public: | 383 // BrowserView, public: |
| 388 | 384 |
| 389 BrowserView::BrowserView() | 385 BrowserView::BrowserView() |
| 390 : views::ClientView(NULL, NULL), | 386 : views::ClientView(NULL, NULL), |
| 391 last_focused_view_storage_id_( | 387 last_focused_view_storage_id_( |
| 392 views::ViewStorage::GetInstance()->CreateStorageID()), | 388 views::ViewStorage::GetInstance()->CreateStorageID()), |
| 393 frame_(NULL), | 389 frame_(NULL), |
| 394 top_container_(NULL), | 390 top_container_(NULL), |
| 395 tabstrip_(NULL), | 391 tabstrip_(NULL), |
| 396 toolbar_(NULL), | 392 toolbar_(NULL), |
| 397 window_switcher_button_(NULL), | |
| 398 find_bar_host_view_(NULL), | 393 find_bar_host_view_(NULL), |
| 399 infobar_container_(NULL), | 394 infobar_container_(NULL), |
| 400 contents_web_view_(NULL), | 395 contents_web_view_(NULL), |
| 401 contents_container_(NULL), | 396 contents_container_(NULL), |
| 402 devtools_window_(NULL), | 397 devtools_window_(NULL), |
| 403 initialized_(false), | 398 initialized_(false), |
| 404 in_process_fullscreen_(false), | 399 in_process_fullscreen_(false), |
| 405 #if defined(OS_WIN) | 400 #if defined(OS_WIN) |
| 406 hung_window_detector_(&hung_plugin_action_), | 401 hung_window_detector_(&hung_plugin_action_), |
| 407 ticker_(0), | 402 ticker_(0), |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 return false; | 926 return false; |
| 932 } | 927 } |
| 933 #endif // defined(OS_WIN) | 928 #endif // defined(OS_WIN) |
| 934 | 929 |
| 935 void BrowserView::RestoreFocus() { | 930 void BrowserView::RestoreFocus() { |
| 936 WebContents* selected_web_contents = GetActiveWebContents(); | 931 WebContents* selected_web_contents = GetActiveWebContents(); |
| 937 if (selected_web_contents) | 932 if (selected_web_contents) |
| 938 selected_web_contents->RestoreFocus(); | 933 selected_web_contents->RestoreFocus(); |
| 939 } | 934 } |
| 940 | 935 |
| 941 void BrowserView::SetWindowSwitcherButton(views::Button* button) { | |
| 942 if (window_switcher_button_) | |
| 943 RemoveChildView(window_switcher_button_); | |
| 944 window_switcher_button_ = button; | |
| 945 } | |
| 946 | |
| 947 void BrowserView::FullscreenStateChanged() { | 936 void BrowserView::FullscreenStateChanged() { |
| 948 CHECK(!IsFullscreen()); | 937 CHECK(!IsFullscreen()); |
| 949 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE); | 938 ProcessFullscreen(false, NORMAL_FULLSCREEN, GURL(), FEB_TYPE_NONE); |
| 950 } | 939 } |
| 951 | 940 |
| 952 void BrowserView::ToolbarSizeChanged(bool is_animating) { | 941 void BrowserView::ToolbarSizeChanged(bool is_animating) { |
| 953 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in | 942 // The call to InfoBarContainer::SetMaxTopArrowHeight() below can result in |
| 954 // reentrancy; |call_state| tracks whether we're reentrant. We can't just | 943 // reentrancy; |call_state| tracks whether we're reentrant. We can't just |
| 955 // early-return in this case because we need to layout again so the infobar | 944 // early-return in this case because we need to layout again so the infobar |
| 956 // container's bounds are set correctly. | 945 // container's bounds are set correctly. |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 toolbar_->Init(); | 1944 toolbar_->Init(); |
| 1956 | 1945 |
| 1957 InitStatusBubble(); | 1946 InitStatusBubble(); |
| 1958 InitPermissionBubbleView(); | 1947 InitPermissionBubbleView(); |
| 1959 | 1948 |
| 1960 // Create do-nothing view for the sake of controlling the z-order of the find | 1949 // Create do-nothing view for the sake of controlling the z-order of the find |
| 1961 // bar widget. | 1950 // bar widget. |
| 1962 find_bar_host_view_ = new View(); | 1951 find_bar_host_view_ = new View(); |
| 1963 AddChildView(find_bar_host_view_); | 1952 AddChildView(find_bar_host_view_); |
| 1964 | 1953 |
| 1965 if (window_switcher_button_) | |
| 1966 AddChildView(window_switcher_button_); | |
| 1967 | |
| 1968 immersive_mode_controller_->Init(this); | 1954 immersive_mode_controller_->Init(this); |
| 1969 | 1955 |
| 1970 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; | 1956 BrowserViewLayout* browser_view_layout = new BrowserViewLayout; |
| 1971 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), | 1957 browser_view_layout->Init(new BrowserViewLayoutDelegateImpl(this), |
| 1972 browser(), | 1958 browser(), |
| 1973 this, | 1959 this, |
| 1974 top_container_, | 1960 top_container_, |
| 1975 tabstrip_, | 1961 tabstrip_, |
| 1976 toolbar_, | 1962 toolbar_, |
| 1977 infobar_container_, | 1963 infobar_container_, |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2519 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2534 gfx::Point icon_bottom( | 2520 gfx::Point icon_bottom( |
| 2535 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2521 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2536 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2522 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2537 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2523 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2538 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2524 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2539 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2525 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2540 } | 2526 } |
| 2541 return top_arrow_height; | 2527 return top_arrow_height; |
| 2542 } | 2528 } |
| OLD | NEW |