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

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: 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 DCHECK(platform_observer_);
James Cook 2014/01/06 17:54:12 nit: I don't think you need to DCHECK these pointe
Matt Giuca 2014/01/06 23:51:40 Done.
432 if (platform_observer_ && !platform_observer_->ShouldShowTitleBar()) 432 return platform_observer_->ShouldShowTitleBar() && delegate &&
433 return false; 433 delegate->ShouldShowWindowIcon();
434 return delegate && delegate->ShouldShowWindowIcon();
435 } 434 }
436 435
437 bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const { 436 bool OpaqueBrowserFrameView::ShouldShowWindowTitle() const {
438 // |delegate| may be NULL if called from callback of InputMethodChanged while 437 // |delegate| may be NULL if called from callback of InputMethodChanged while
439 // a window is being destroyed. 438 // a window is being destroyed.
440 // See more discussion at http://crosbug.com/8958 439 // See more discussion at http://crosbug.com/8958
441 views::WidgetDelegate* delegate = frame()->widget_delegate(); 440 views::WidgetDelegate* delegate = frame()->widget_delegate();
442 // ShouldShowTitleBar defaults to true. 441 DCHECK(platform_observer_);
443 if (platform_observer_ && !platform_observer_->ShouldShowTitleBar()) 442 return platform_observer_->ShouldShowTitleBar() && delegate &&
444 return false; 443 delegate->ShouldShowWindowTitle();
445 return delegate && delegate->ShouldShowWindowTitle();
446 } 444 }
447 445
448 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const { 446 base::string16 OpaqueBrowserFrameView::GetWindowTitle() const {
449 return frame()->widget_delegate()->GetWindowTitle(); 447 return frame()->widget_delegate()->GetWindowTitle();
450 } 448 }
451 449
452 int OpaqueBrowserFrameView::GetIconSize() const { 450 int OpaqueBrowserFrameView::GetIconSize() const {
453 #if defined(OS_WIN) 451 #if defined(OS_WIN)
454 // This metric scales up if either the titlebar height or the titlebar font 452 // This metric scales up if either the titlebar height or the titlebar font
455 // size are increased. 453 // size are increased.
456 return GetSystemMetrics(SM_CYSMICON); 454 return GetSystemMetrics(SM_CYSMICON);
457 #else 455 #else
458 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize); 456 return std::max(BrowserFrame::GetTitleFont().GetHeight(), kIconMinimumSize);
459 #endif 457 #endif
460 } 458 }
461 459
462 bool OpaqueBrowserFrameView::ShouldLeaveOffsetNearTopBorder() const { 460 bool OpaqueBrowserFrameView::ShouldLeaveOffsetNearTopBorder() const {
463 return frame()->ShouldLeaveOffsetNearTopBorder(); 461 return frame()->ShouldLeaveOffsetNearTopBorder();
464 } 462 }
465 463
466 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const { 464 gfx::Size OpaqueBrowserFrameView::GetBrowserViewMinimumSize() const {
467 return browser_view()->GetMinimumSize(); 465 return browser_view()->GetMinimumSize();
468 } 466 }
469 467
470 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const { 468 bool OpaqueBrowserFrameView::ShouldShowCaptionButtons() const {
471 if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons()) 469 if (!OpaqueBrowserFrameViewLayout::ShouldAddDefaultCaptionButtons())
472 return false; 470 return false;
473 if (!platform_observer_) 471 DCHECK(platform_observer_);
474 return true;
475 return platform_observer_->ShouldShowCaptionButtons(); 472 return platform_observer_->ShouldShowCaptionButtons();
476 } 473 }
477 474
478 bool OpaqueBrowserFrameView::ShouldShowAvatar() const { 475 bool OpaqueBrowserFrameView::ShouldShowAvatar() const {
479 return browser_view()->ShouldShowAvatar(); 476 return browser_view()->ShouldShowAvatar();
480 } 477 }
481 478
482 bool OpaqueBrowserFrameView::IsRegularOrGuestSession() const { 479 bool OpaqueBrowserFrameView::IsRegularOrGuestSession() const {
483 return browser_view()->IsRegularOrGuestSession(); 480 return browser_view()->IsRegularOrGuestSession();
484 } 481 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 897
901 int OpaqueBrowserFrameView::GetTopAreaHeight() const { 898 int OpaqueBrowserFrameView::GetTopAreaHeight() const {
902 gfx::ImageSkia* frame_image = GetFrameImage(); 899 gfx::ImageSkia* frame_image = GetFrameImage();
903 int top_area_height = frame_image->height(); 900 int top_area_height = frame_image->height();
904 if (browser_view()->IsTabStripVisible()) { 901 if (browser_view()->IsTabStripVisible()) {
905 top_area_height = std::max(top_area_height, 902 top_area_height = std::max(top_area_height,
906 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); 903 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom());
907 } 904 }
908 return top_area_height; 905 return top_area_height;
909 } 906 }
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