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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include "chrome/browser/views/frame/browser_view2.h" | 7 #include "chrome/browser/views/frame/browser_view2.h" |
8 | 8 |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/app/theme/theme_resources.h" | 10 #include "chrome/app/theme/theme_resources.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // The distance of the status bubble from the left edge of the window. | 48 // The distance of the status bubble from the left edge of the window. |
49 static const int kStatusBubbleOffset = 2; | 49 static const int kStatusBubbleOffset = 2; |
50 // An offset distance between certain toolbars and the toolbar that preceded | 50 // An offset distance between certain toolbars and the toolbar that preceded |
51 // them in layout. | 51 // them in layout. |
52 static const int kSeparationLineHeight = 1; | 52 static const int kSeparationLineHeight = 1; |
53 // The name of a key to store on the window handle so that other code can | 53 // The name of a key to store on the window handle so that other code can |
54 // locate this object using just the handle. | 54 // locate this object using just the handle. |
55 static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; | 55 static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; |
56 // The distance between tiled windows. | 56 // The distance between tiled windows. |
57 static const int kWindowTilePixels = 10; | 57 static const int kWindowTilePixels = 10; |
| 58 // The distance between the top edge of the window and the TabStrip when there |
| 59 // is no title-bar showing, and the window is restored. |
| 60 static const int kNoTitleTopSpacing = 15; |
| 61 // The distance between the top edge of the window and the TabStrip when there |
| 62 // is no title-bar showing, and the window is maximized. |
| 63 static const int kNoTitleZoomedTopSpacing = 1; |
58 | 64 |
59 static const struct { bool separator; int command; int label; } kMenuLayout[] =
{ | 65 static const struct { bool separator; int command; int label; } kMenuLayout[] =
{ |
60 { true, 0, 0 }, | 66 { true, 0, 0 }, |
61 { false, IDC_TASKMANAGER, IDS_TASKMANAGER }, | 67 { false, IDC_TASKMANAGER, IDS_TASKMANAGER }, |
62 { true, 0, 0 }, | 68 { true, 0, 0 }, |
63 { false, IDC_ENCODING, IDS_ENCODING }, | 69 { false, IDC_ENCODING, IDS_ENCODING }, |
64 { false, IDC_ZOOM, IDS_ZOOM }, | 70 { false, IDC_ZOOM, IDS_ZOOM }, |
65 { false, IDC_PRINT, IDS_PRINT }, | 71 { false, IDC_PRINT, IDS_PRINT }, |
66 { false, IDC_SAVEPAGE, IDS_SAVEPAGEAS }, | 72 { false, IDC_SAVEPAGE, IDS_SAVEPAGEAS }, |
67 { false, IDC_FIND, IDS_FIND_IN_PAGE }, | 73 { false, IDC_FIND, IDS_FIND_IN_PAGE }, |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 top = LayoutBookmarkAndInfoBars(top); | 780 top = LayoutBookmarkAndInfoBars(top); |
775 int bottom = LayoutDownloadShelf(); | 781 int bottom = LayoutDownloadShelf(); |
776 LayoutTabContents(top, bottom); | 782 LayoutTabContents(top, bottom); |
777 LayoutStatusBubble(bottom); | 783 LayoutStatusBubble(bottom); |
778 #ifdef CHROME_PERSONALIZATION | 784 #ifdef CHROME_PERSONALIZATION |
779 if (IsPersonalizationEnabled()) { | 785 if (IsPersonalizationEnabled()) { |
780 Personalization::ConfigureFramePersonalization(personalization_, | 786 Personalization::ConfigureFramePersonalization(personalization_, |
781 toolbar_, 0); | 787 toolbar_, 0); |
782 } | 788 } |
783 #endif | 789 #endif |
784 | |
785 | |
786 SchedulePaint(); | 790 SchedulePaint(); |
787 } | 791 } |
788 | 792 |
789 void BrowserView2::DidChangeBounds(const CRect& previous, | 793 void BrowserView2::DidChangeBounds(const CRect& previous, |
790 const CRect& current) { | 794 const CRect& current) { |
791 Layout(); | 795 Layout(); |
792 } | 796 } |
793 | 797 |
794 void BrowserView2::ViewHierarchyChanged(bool is_add, | 798 void BrowserView2::ViewHierarchyChanged(bool is_add, |
795 ChromeViews::View* parent, | 799 ChromeViews::View* parent, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ChromeViews::DropTargetEvent* BrowserView2::MapEventToTabStrip( | 885 ChromeViews::DropTargetEvent* BrowserView2::MapEventToTabStrip( |
882 const ChromeViews::DropTargetEvent& event) { | 886 const ChromeViews::DropTargetEvent& event) { |
883 gfx::Point tab_strip_loc(event.location()); | 887 gfx::Point tab_strip_loc(event.location()); |
884 ConvertPointToView(this, tabstrip_, &tab_strip_loc); | 888 ConvertPointToView(this, tabstrip_, &tab_strip_loc); |
885 return new ChromeViews::DropTargetEvent(event.GetData(), tab_strip_loc.x(), | 889 return new ChromeViews::DropTargetEvent(event.GetData(), tab_strip_loc.x(), |
886 tab_strip_loc.y(), | 890 tab_strip_loc.y(), |
887 event.GetSourceOperations()); | 891 event.GetSourceOperations()); |
888 } | 892 } |
889 | 893 |
890 int BrowserView2::LayoutTabStrip() { | 894 int BrowserView2::LayoutTabStrip() { |
| 895 gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); |
891 if (IsTabStripVisible()) { | 896 if (IsTabStripVisible()) { |
892 gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_); | |
893 tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(), | 897 tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(), |
894 tabstrip_bounds.width(), tabstrip_bounds.height()); | 898 tabstrip_bounds.width(), tabstrip_bounds.height()); |
895 return tabstrip_bounds.bottom(); | |
896 } | 899 } |
897 return 0; | 900 return tabstrip_bounds.bottom(); |
898 } | 901 } |
899 | 902 |
900 int BrowserView2::LayoutToolbar(int top) { | 903 int BrowserView2::LayoutToolbar(int top) { |
901 if (IsToolbarVisible()) { | 904 if (IsToolbarVisible()) { |
902 CSize ps; | 905 CSize ps; |
903 toolbar_->GetPreferredSize(&ps); | 906 toolbar_->GetPreferredSize(&ps); |
904 int toolbar_y = | 907 int toolbar_y = |
905 top - (IsTabStripVisible() ? kToolbarTabStripVerticalOverlap : 0); | 908 top - (IsTabStripVisible() ? kToolbarTabStripVerticalOverlap : 0); |
906 // With detached popup windows with the aero glass frame, we need to offset | 909 // With detached popup windows with the aero glass frame, we need to offset |
907 // by a pixel to make things look good. | 910 // by a pixel to make things look good. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 // static | 1197 // static |
1195 void BrowserView2::InitClass() { | 1198 void BrowserView2::InitClass() { |
1196 static bool initialized = false; | 1199 static bool initialized = false; |
1197 if (!initialized) { | 1200 if (!initialized) { |
1198 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1201 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
1199 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 1202 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
1200 initialized = true; | 1203 initialized = true; |
1201 } | 1204 } |
1202 } | 1205 } |
1203 | 1206 |
OLD | NEW |