| 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 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/views/toolbar_star_toggle.h" | 28 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 29 #include "chrome/browser/view_ids.h" | 29 #include "chrome/browser/view_ids.h" |
| 30 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/drag_drop_types.h" | 31 #include "chrome/common/drag_drop_types.h" |
| 32 #include "chrome/common/l10n_util.h" | 32 #include "chrome/common/l10n_util.h" |
| 33 #include "chrome/common/notification_service.h" | 33 #include "chrome/common/notification_service.h" |
| 34 #include "chrome/common/os_exchange_data.h" | 34 #include "chrome/common/os_exchange_data.h" |
| 35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/pref_service.h" | 36 #include "chrome/common/pref_service.h" |
| 37 #include "chrome/common/resource_bundle.h" | 37 #include "chrome/common/resource_bundle.h" |
| 38 #include "chrome/common/win_util.h" |
| 38 #include "chrome/views/background.h" | 39 #include "chrome/views/background.h" |
| 39 #include "chrome/views/button_dropdown.h" | 40 #include "chrome/views/button_dropdown.h" |
| 40 #include "chrome/views/hwnd_view.h" | 41 #include "chrome/views/hwnd_view.h" |
| 41 #include "chrome/views/label.h" | 42 #include "chrome/views/label.h" |
| 42 #include "chrome/views/non_client_view.h" | 43 #include "chrome/views/non_client_view.h" |
| 43 #include "chrome/views/tooltip_manager.h" | 44 #include "chrome/views/tooltip_manager.h" |
| 44 #include "chrome/views/widget.h" | 45 #include "chrome/views/widget.h" |
| 45 #include "net/base/net_util.h" | 46 #include "net/base/net_util.h" |
| 46 | 47 |
| 47 #include "chromium_strings.h" | 48 #include "chromium_strings.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 gfx::Size BrowserToolbarView::GetPreferredSize() { | 473 gfx::Size BrowserToolbarView::GetPreferredSize() { |
| 473 if (IsDisplayModeNormal()) { | 474 if (IsDisplayModeNormal()) { |
| 474 static SkBitmap normal_background; | 475 static SkBitmap normal_background; |
| 475 if (normal_background.isNull()) { | 476 if (normal_background.isNull()) { |
| 476 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 477 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 477 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); | 478 normal_background = *rb.GetBitmapNamed(IDR_CONTENT_TOP_CENTER); |
| 478 } | 479 } |
| 479 return gfx::Size(0, normal_background.height()); | 480 return gfx::Size(0, normal_background.height()); |
| 480 } | 481 } |
| 481 | 482 |
| 483 // With the non-Vista frame, we'll draw a client edge below the toolbar for |
| 484 // non-maximized popups. |
| 482 // Note: We make sure to return the same value in the "no browser window" case | 485 // 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 | 486 // 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 | 487 // 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 | 488 // 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 | 489 // we're actually laying things out after setting up the browser window. This |
| 487 // prevents the content area from being off by |kClientEdgeThickness| px. | 490 // prevents the content area from being off by |kClientEdgeThickness| px. |
| 488 int client_edge_height = | 491 int client_edge_height = win_util::ShouldUseVistaFrame() || |
| 489 (browser_->window() && browser_->window()->IsMaximized()) ? | 492 (browser_->window() && browser_->window()->IsMaximized()) ? |
| 490 0 : views::NonClientView::kClientEdgeThickness; | 493 0 : views::NonClientView::kClientEdgeThickness; |
| 491 return gfx::Size(0, | 494 return gfx::Size(0, |
| 492 location_bar_->GetPreferredSize().height() + client_edge_height); | 495 location_bar_->GetPreferredSize().height() + client_edge_height); |
| 493 } | 496 } |
| 494 | 497 |
| 495 void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { | 498 void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { |
| 496 Menu::AnchorPoint anchor = Menu::TOPRIGHT; | 499 Menu::AnchorPoint anchor = Menu::TOPRIGHT; |
| 497 if (UILayoutIsRightToLeft()) | 500 if (UILayoutIsRightToLeft()) |
| 498 anchor = Menu::TOPLEFT; | 501 anchor = Menu::TOPLEFT; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 *accel = views::Accelerator(L'C', false, true, false); | 812 *accel = views::Accelerator(L'C', false, true, false); |
| 810 return true; | 813 return true; |
| 811 case IDC_PASTE: | 814 case IDC_PASTE: |
| 812 *accel = views::Accelerator(L'V', false, true, false); | 815 *accel = views::Accelerator(L'V', false, true, false); |
| 813 return true; | 816 return true; |
| 814 } | 817 } |
| 815 // Else, we retrieve the accelerator information from the frame. | 818 // Else, we retrieve the accelerator information from the frame. |
| 816 return GetWidget()->GetAccelerator(id, accel); | 819 return GetWidget()->GetAccelerator(id, accel); |
| 817 } | 820 } |
| 818 | 821 |
| OLD | NEW |