| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 gfx::Size BrowserToolbarView::GetPreferredSize() { | 472 gfx::Size BrowserToolbarView::GetPreferredSize() { |
| 473 if (IsDisplayModeNormal()) { | 473 if (IsDisplayModeNormal()) { |
| 474 static SkBitmap normal_background; | 474 static SkBitmap normal_background; |
| 475 if (normal_background.isNull()) { | 475 if (normal_background.isNull()) { |
| 476 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 476 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 477 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); | 477 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); |
| 478 } | 478 } |
| 479 return gfx::Size(0, normal_background.height()); | 479 return gfx::Size(0, normal_background.height()); |
| 480 } | 480 } |
| 481 | 481 |
| 482 // Note: We make sure to return the same value in the "no browser window" case |
| 483 // as the "not maximized" case, so that when a popup is opened at a particular |
| 484 // requested size, we'll report the same preferred size during the initial |
| 485 // window size calculation (when there isn't yet a browser window) as when |
| 486 // we're actually laying things out after setting up the browser window. This |
| 487 // prevents the content area from being off by |kClientEdgeThickness| px. |
| 482 int client_edge_height = | 488 int client_edge_height = |
| 483 (browser_->window() && !browser_->window()->IsMaximized()) ? | 489 (browser_->window() && browser_->window()->IsMaximized()) ? |
| 484 BrowserView::kClientEdgeThickness : 0; | 490 0 : BrowserView::kClientEdgeThickness; |
| 485 return gfx::Size(0, | 491 return gfx::Size(0, |
| 486 location_bar_->GetPreferredSize().height() + client_edge_height); | 492 location_bar_->GetPreferredSize().height() + client_edge_height); |
| 487 } | 493 } |
| 488 | 494 |
| 489 void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { | 495 void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { |
| 490 Menu::AnchorPoint anchor = Menu::TOPRIGHT; | 496 Menu::AnchorPoint anchor = Menu::TOPRIGHT; |
| 491 if (UILayoutIsRightToLeft()) | 497 if (UILayoutIsRightToLeft()) |
| 492 anchor = Menu::TOPLEFT; | 498 anchor = Menu::TOPLEFT; |
| 493 | 499 |
| 494 Menu menu(this, anchor, hwnd); | 500 Menu menu(this, anchor, hwnd); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 *accel = views::Accelerator(L'C', false, true, false); | 809 *accel = views::Accelerator(L'C', false, true, false); |
| 804 return true; | 810 return true; |
| 805 case IDC_PASTE: | 811 case IDC_PASTE: |
| 806 *accel = views::Accelerator(L'V', false, true, false); | 812 *accel = views::Accelerator(L'V', false, true, false); |
| 807 return true; | 813 return true; |
| 808 } | 814 } |
| 809 // Else, we retrieve the accelerator information from the frame. | 815 // Else, we retrieve the accelerator information from the frame. |
| 810 return GetWidget()->GetAccelerator(id, accel); | 816 return GetWidget()->GetAccelerator(id, accel); |
| 811 } | 817 } |
| 812 | 818 |
| OLD | NEW |