Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 124893002: OpaqueBrowserFrameViewPlatformSpecific::Create no longer returns NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant DCHECKs. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_specific.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 NOTREACHED() << "Got a notification we didn't register for!"; 421 NOTREACHED() << "Got a notification we didn't register for!";
422 break; 422 break;
423 } 423 }
424 } 424 }
425 425
426 /////////////////////////////////////////////////////////////////////////////// 426 ///////////////////////////////////////////////////////////////////////////////
427 // OpaqueBrowserFrameView, OpaqueBrowserFrameViewLayoutDelegate implementation: 427 // OpaqueBrowserFrameView, OpaqueBrowserFrameViewLayoutDelegate implementation:
428 428
429 bool OpaqueBrowserFrameView::ShouldShowWindowIcon() const { 429 bool OpaqueBrowserFrameView::ShouldShowWindowIcon() const {
430 views::WidgetDelegate* delegate = frame()->widget_delegate(); 430 views::WidgetDelegate* delegate = frame()->widget_delegate();
431 // ShouldShowTitleBar defaults to true. 431 return platform_observer_->ShouldShowTitleBar() && delegate &&
432 if (platform_observer_ && !platform_observer_->ShouldShowTitleBar()) 432 delegate->ShouldShowWindowIcon();
433 return false;
434 return delegate && delegate->ShouldShowWindowIcon();
435 } 433 }
436 434
437 bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const { 435 bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const {
438 // |delegate| may be NULL if called from callback of InputMethodChanged while 436 // |delegate| may be NULL if called from callback of InputMethodChanged while
439 // a window is being destroyed. 437 // a window is being destroyed.
440 // See more discussion at http://crosbug.com/8958 438 // See more discussion at http://crosbug.com/8958
441 views::WidgetDelegate* delegate = frame()->widget_delegate(); 439 views::WidgetDelegate* delegate = frame()->widget_delegate();
442 // ShouldShowTitleBar defaults to true. 440 return platform_observer_->ShouldShowTitleBar() && delegate &&
443 if (platform_observer_ && !platform_observer_->ShouldShowTitleBar()) 441 delegate->ShouldShowWindowTitle();
444 return false;
445 return delegate && delegate->ShouldShowWindowTitle();
446 } 442 }
447 443
448 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const { 444 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const {
449 return frame()->widget_delegate()->GetWindowTitle(); 445 return frame()->widget_delegate()->GetWindowTitle();
450 } 446 }
451 447
452 int OpaqueBrowserFrameView::GetIconSize() const { 448 int OpaqueBrowserFrameView::GetIconSize() const {
453 #if defined(OS_WIN) 449 #if defined(OS_WIN)
454 // This metric scales up if either the titlebar height or the titlebar font 450 // This metric scales up if either the titlebar height or the titlebar font
455 // size are increased. 451 // size are increased.
456 return GetSystemMetrics(SM_CYSMICON); 452 return GetSystemMetrics(SM_CYSMICON);
457 #else 453 #else
458 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize); 454 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize);
459 #endif 455 #endif
460 } 456 }
461 457
462 bool OpaqueBrowserFrameView::ShouldLeaveOffsetNearTopBorder() const { 458 bool OpaqueBrowserFrameView::ShouldLeaveOffsetNearTopBorder() const {
463 return frame()->ShouldLeaveOffsetNearTopBorder(); 459 return frame()->ShouldLeaveOffsetNearTopBorder();
464 } 460 }
465 461
466 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { 462 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const {
467 return browser_view()->GetMinimumSize(); 463 return browser_view()->GetMinimumSize();
468 } 464 }
469 465
470 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const { 466 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const {
471 if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons()) 467 if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons())
472 return false; 468 return false;
473 if (!platform_observer_)
474 return true;
475 return platform_observer_->ShouldShowCaptionButtons(); 469 return platform_observer_->ShouldShowCaptionButtons();
476 } 470 }
477 471
478 bool OpaqueBrowserFrameView::ShouldShowAvatar() const { 472 bool OpaqueBrowserFrameView::ShouldShowAvatar() const {
479 return browser_view()->ShouldShowAvatar(); 473 return browser_view()->ShouldShowAvatar();
480 } 474 }
481 475
482 bool OpaqueBrowserFrameView::IsRegularOrGuestSession() const { 476 bool OpaqueBrowserFrameView::IsRegularOrGuestSession() const {
483 return browser_view()->IsRegularOrGuestSession(); 477 return browser_view()->IsRegularOrGuestSession();
484 } 478 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 894
901 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 895 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
902 gfx::ImageSkia* frame_image = GetFrameImage(); 896 gfx::ImageSkia* frame_image = GetFrameImage();
903 int top_area_height = frame_image->height(); 897 int top_area_height = frame_image->height();
904 if (browser_view()->IsTabStripVisible()) { 898 if (browser_view()->IsTabStripVisible()) {
905 top_area_height = std::max(top_area_height, 899 top_area_height = std::max(top_area_height,
906 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 900 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
907 } 901 }
908 return top_area_height; 902 return top_area_height;
909 } 903 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view_platform_specific.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698