| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 const char BrowserView::kViewClassName[] = "BrowserView"; | 232 const char BrowserView::kViewClassName[] = "BrowserView"; |
| 233 | 233 |
| 234 /////////////////////////////////////////////////////////////////////////////// | 234 /////////////////////////////////////////////////////////////////////////////// |
| 235 | 235 |
| 236 // Delegate implementation for BrowserViewLayout. Usually just forwards calls | 236 // Delegate implementation for BrowserViewLayout. Usually just forwards calls |
| 237 // into BrowserView. | 237 // into BrowserView. |
| 238 class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate { | 238 class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate { |
| 239 public: | 239 public: |
| 240 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) | 240 explicit BrowserViewLayoutDelegateImpl(BrowserView* browser_view) |
| 241 : browser_view_(browser_view) {} | 241 : browser_view_(browser_view) {} |
| 242 virtual ~BrowserViewLayoutDelegateImpl() {} | 242 ~BrowserViewLayoutDelegateImpl() override {} |
| 243 | 243 |
| 244 // BrowserViewLayoutDelegate overrides: | 244 // BrowserViewLayoutDelegate overrides: |
| 245 virtual views::View* GetContentsWebView() const override { | 245 views::View* GetContentsWebView() const override { |
| 246 return browser_view_->contents_web_view_; | 246 return browser_view_->contents_web_view_; |
| 247 } | 247 } |
| 248 | 248 |
| 249 virtual bool DownloadShelfNeedsLayout() const override { | 249 bool DownloadShelfNeedsLayout() const override { |
| 250 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); | 250 DownloadShelfView* download_shelf = browser_view_->download_shelf_.get(); |
| 251 // Re-layout the shelf either if it is visible or if its close animation | 251 // Re-layout the shelf either if it is visible or if its close animation |
| 252 // is currently running. | 252 // is currently running. |
| 253 return download_shelf && | 253 return download_shelf && |
| 254 (download_shelf->IsShowing() || download_shelf->IsClosing()); | 254 (download_shelf->IsShowing() || download_shelf->IsClosing()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 virtual bool IsTabStripVisible() const override { | 257 bool IsTabStripVisible() const override { |
| 258 return browser_view_->IsTabStripVisible(); | 258 return browser_view_->IsTabStripVisible(); |
| 259 } | 259 } |
| 260 | 260 |
| 261 virtual gfx::Rect GetBoundsForTabStripInBrowserView() const override { | 261 gfx::Rect GetBoundsForTabStripInBrowserView() const override { |
| 262 gfx::RectF bounds_f(browser_view_->frame()->GetBoundsForTabStrip( | 262 gfx::RectF bounds_f(browser_view_->frame()->GetBoundsForTabStrip( |
| 263 browser_view_->tabstrip())); | 263 browser_view_->tabstrip())); |
| 264 views::View::ConvertRectToTarget(browser_view_->parent(), browser_view_, | 264 views::View::ConvertRectToTarget(browser_view_->parent(), browser_view_, |
| 265 &bounds_f); | 265 &bounds_f); |
| 266 return gfx::ToEnclosingRect(bounds_f); | 266 return gfx::ToEnclosingRect(bounds_f); |
| 267 } | 267 } |
| 268 | 268 |
| 269 virtual int GetTopInsetInBrowserView() const override { | 269 int GetTopInsetInBrowserView() const override { |
| 270 return browser_view_->frame()->GetTopInset() - | 270 return browser_view_->frame()->GetTopInset() - |
| 271 browser_view_->y(); | 271 browser_view_->y(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 virtual int GetThemeBackgroundXInset() const override { | 274 int GetThemeBackgroundXInset() const override { |
| 275 // TODO(pkotwicz): Return the inset with respect to the left edge of the | 275 // TODO(pkotwicz): Return the inset with respect to the left edge of the |
| 276 // BrowserView. | 276 // BrowserView. |
| 277 return browser_view_->frame()->GetThemeBackgroundXInset(); | 277 return browser_view_->frame()->GetThemeBackgroundXInset(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 virtual bool IsToolbarVisible() const override { | 280 bool IsToolbarVisible() const override { |
| 281 return browser_view_->IsToolbarVisible(); | 281 return browser_view_->IsToolbarVisible(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 virtual bool IsBookmarkBarVisible() const override { | 284 bool IsBookmarkBarVisible() const override { |
| 285 return browser_view_->IsBookmarkBarVisible(); | 285 return browser_view_->IsBookmarkBarVisible(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 virtual FullscreenExitBubbleViews* GetFullscreenExitBubble() const override { | 288 FullscreenExitBubbleViews* GetFullscreenExitBubble() const override { |
| 289 return browser_view_->fullscreen_exit_bubble(); | 289 return browser_view_->fullscreen_exit_bubble(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 private: | 292 private: |
| 293 BrowserView* browser_view_; | 293 BrowserView* browser_view_; |
| 294 | 294 |
| 295 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutDelegateImpl); | 295 DISALLOW_COPY_AND_ASSIGN(BrowserViewLayoutDelegateImpl); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 /////////////////////////////////////////////////////////////////////////////// | 298 /////////////////////////////////////////////////////////////////////////////// |
| 299 // BookmarkExtensionBackground, private: | 299 // BookmarkExtensionBackground, private: |
| 300 // This object serves as the views::Background object which is used to layout | 300 // This object serves as the views::Background object which is used to layout |
| 301 // and paint the bookmark bar. | 301 // and paint the bookmark bar. |
| 302 class BookmarkExtensionBackground : public views::Background { | 302 class BookmarkExtensionBackground : public views::Background { |
| 303 public: | 303 public: |
| 304 BookmarkExtensionBackground(BrowserView* browser_view, | 304 BookmarkExtensionBackground(BrowserView* browser_view, |
| 305 DetachableToolbarView* host_view, | 305 DetachableToolbarView* host_view, |
| 306 Browser* browser); | 306 Browser* browser); |
| 307 | 307 |
| 308 // View methods overridden from views:Background. | 308 // View methods overridden from views:Background. |
| 309 virtual void Paint(gfx::Canvas* canvas, views::View* view) const override; | 309 void Paint(gfx::Canvas* canvas, views::View* view) const override; |
| 310 | 310 |
| 311 private: | 311 private: |
| 312 BrowserView* browser_view_; | 312 BrowserView* browser_view_; |
| 313 | 313 |
| 314 // The view hosting this background. | 314 // The view hosting this background. |
| 315 DetachableToolbarView* host_view_; | 315 DetachableToolbarView* host_view_; |
| 316 | 316 |
| 317 Browser* browser_; | 317 Browser* browser_; |
| 318 | 318 |
| 319 DISALLOW_COPY_AND_ASSIGN(BookmarkExtensionBackground); | 319 DISALLOW_COPY_AND_ASSIGN(BookmarkExtensionBackground); |
| (...skipping 2193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2513 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2514 gfx::Point icon_bottom( | 2514 gfx::Point icon_bottom( |
| 2515 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2515 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2516 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2516 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2517 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2517 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2518 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2518 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2519 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2519 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2520 } | 2520 } |
| 2521 return top_arrow_height; | 2521 return top_arrow_height; |
| 2522 } | 2522 } |
| OLD | NEW |