| 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_view.h" | 7 #include "chrome/browser/views/frame/browser_view.h" |
| 8 | 8 |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // static | 54 // static |
| 55 SkBitmap BrowserView::default_favicon_; | 55 SkBitmap BrowserView::default_favicon_; |
| 56 SkBitmap BrowserView::otr_avatar_; | 56 SkBitmap BrowserView::otr_avatar_; |
| 57 // The vertical overlap between the TabStrip and the Toolbar. | 57 // The vertical overlap between the TabStrip and the Toolbar. |
| 58 static const int kToolbarTabStripVerticalOverlap = 3; | 58 static const int kToolbarTabStripVerticalOverlap = 3; |
| 59 // The visible height of the shadow above the tabs. Clicks in this area are | 59 // The visible height of the shadow above the tabs. Clicks in this area are |
| 60 // treated as clicks to the frame, rather than clicks to the tab. | 60 // treated as clicks to the frame, rather than clicks to the tab. |
| 61 static const int kTabShadowSize = 2; | 61 static const int kTabShadowSize = 2; |
| 62 // The height of the status bubble. | 62 // The height of the status bubble. |
| 63 static const int kStatusBubbleHeight = 20; | 63 static const int kStatusBubbleHeight = 20; |
| 64 // The distance of the status bubble from the left edge of the window. | 64 // The overlap of the status bubble with the left edge of the window. |
| 65 static const int kStatusBubbleHorizontalOffset = 3; | 65 static const int kStatusBubbleHorizontalOverlap = 2; |
| 66 // The distance of the status bubble from the bottom edge of the window. | 66 // The overlap of the status bubble with the bottom edge of the window. |
| 67 static const int kStatusBubbleVerticalOffset = 2; | 67 static const int kStatusBubbleVerticalOverlap = 2; |
| 68 // An offset distance between certain toolbars and the toolbar that preceded | 68 // An offset distance between certain toolbars and the toolbar that preceded |
| 69 // them in layout. | 69 // them in layout. |
| 70 static const int kSeparationLineHeight = 1; | 70 static const int kSeparationLineHeight = 1; |
| 71 // The name of a key to store on the window handle so that other code can | 71 // The name of a key to store on the window handle so that other code can |
| 72 // locate this object using just the handle. | 72 // locate this object using just the handle. |
| 73 static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; | 73 static const wchar_t* kBrowserWindowKey = L"__BROWSER_WINDOW__"; |
| 74 // The distance between tiled windows. | 74 // The distance between tiled windows. |
| 75 static const int kWindowTilePixels = 10; | 75 static const int kWindowTilePixels = 10; |
| 76 // How frequently we check for hung plugin windows. | 76 // How frequently we check for hung plugin windows. |
| 77 static const int kDefaultHungPluginDetectFrequency = 2000; | 77 static const int kDefaultHungPluginDetectFrequency = 2000; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (GetLocationBarView()) | 171 if (GetLocationBarView()) |
| 172 GetLocationBarView()->location_entry()->ClosePopup(); | 172 GetLocationBarView()->location_entry()->ClosePopup(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 gfx::Rect BrowserView::GetToolbarBounds() const { | 175 gfx::Rect BrowserView::GetToolbarBounds() const { |
| 176 return toolbar_->bounds(); | 176 return toolbar_->bounds(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 gfx::Rect BrowserView::GetClientAreaBounds() const { | 179 gfx::Rect BrowserView::GetClientAreaBounds() const { |
| 180 gfx::Rect container_bounds = contents_container_->bounds(); | 180 gfx::Rect container_bounds = contents_container_->bounds(); |
| 181 container_bounds.Offset(x(), y()); | 181 gfx::Point container_origin = container_bounds.origin(); |
| 182 ConvertPointToView(this, GetParent(), &container_origin); |
| 183 container_bounds.set_origin(container_origin); |
| 182 return container_bounds; | 184 return container_bounds; |
| 183 } | 185 } |
| 184 | 186 |
| 185 int BrowserView::GetTabStripHeight() const { | 187 int BrowserView::GetTabStripHeight() const { |
| 186 return tabstrip_->GetPreferredHeight(); | 188 return tabstrip_->GetPreferredHeight(); |
| 187 } | 189 } |
| 188 | 190 |
| 189 bool BrowserView::IsToolbarVisible() const { | 191 bool BrowserView::IsToolbarVisible() const { |
| 190 return SupportsWindowFeature(FEATURE_TOOLBAR) || | 192 return SupportsWindowFeature(FEATURE_TOOLBAR) || |
| 191 SupportsWindowFeature(FEATURE_LOCATIONBAR); | 193 SupportsWindowFeature(FEATURE_LOCATIONBAR); |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 gfx::Size ps = active_download_shelf_->GetPreferredSize(); | 1122 gfx::Size ps = active_download_shelf_->GetPreferredSize(); |
| 1121 active_download_shelf_->SetBounds(0, bottom - ps.height(), width(), | 1123 active_download_shelf_->SetBounds(0, bottom - ps.height(), width(), |
| 1122 ps.height()); | 1124 ps.height()); |
| 1123 active_download_shelf_->Layout(); | 1125 active_download_shelf_->Layout(); |
| 1124 bottom -= ps.height(); | 1126 bottom -= ps.height(); |
| 1125 } | 1127 } |
| 1126 return bottom; | 1128 return bottom; |
| 1127 } | 1129 } |
| 1128 | 1130 |
| 1129 void BrowserView::LayoutStatusBubble(int top) { | 1131 void BrowserView::LayoutStatusBubble(int top) { |
| 1130 int status_bubble_y = | 1132 gfx::Point origin(-kStatusBubbleHorizontalOverlap, |
| 1131 top - kStatusBubbleHeight + kStatusBubbleVerticalOffset + y(); | 1133 top - kStatusBubbleHeight + kStatusBubbleVerticalOverlap); |
| 1132 status_bubble_->SetBounds(kStatusBubbleHorizontalOffset, status_bubble_y, | 1134 ConvertPointToView(this, GetParent(), &origin); |
| 1133 width() / 3, kStatusBubbleHeight); | 1135 status_bubble_->SetBounds(origin.x(), origin.y(), width() / 3, |
| 1136 kStatusBubbleHeight); |
| 1134 } | 1137 } |
| 1135 | 1138 |
| 1136 bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) { | 1139 bool BrowserView::MaybeShowBookmarkBar(TabContents* contents) { |
| 1137 views::View* new_bookmark_bar_view = NULL; | 1140 views::View* new_bookmark_bar_view = NULL; |
| 1138 if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && contents) { | 1141 if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && contents) { |
| 1139 new_bookmark_bar_view = GetBookmarkBarView(); | 1142 new_bookmark_bar_view = GetBookmarkBarView(); |
| 1140 if (!show_bookmark_bar_pref_.GetValue() && | 1143 if (!show_bookmark_bar_pref_.GetValue() && |
| 1141 new_bookmark_bar_view->GetPreferredSize().height() == 0) { | 1144 new_bookmark_bar_view->GetPreferredSize().height() == 0) { |
| 1142 new_bookmark_bar_view = NULL; | 1145 new_bookmark_bar_view = NULL; |
| 1143 } | 1146 } |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 | 1356 |
| 1354 // static | 1357 // static |
| 1355 void BrowserView::InitClass() { | 1358 void BrowserView::InitClass() { |
| 1356 static bool initialized = false; | 1359 static bool initialized = false; |
| 1357 if (!initialized) { | 1360 if (!initialized) { |
| 1358 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1361 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 1359 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); | 1362 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); |
| 1360 initialized = true; | 1363 initialized = true; |
| 1361 } | 1364 } |
| 1362 } | 1365 } |
| OLD | NEW |