diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-04 01:59:03 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-04 01:59:03 +0000 |
commit | 207839e902dda33120835cf135dee8649a151ceb (patch) | |
tree | 7087e5d59829e1748fcea8b1ba73cb42d272f856 /chrome/browser | |
parent | e9a30afd2628f9aa9abbea1f18147fe2eb5eb56f (diff) | |
download | chromium_src-207839e902dda33120835cf135dee8649a151ceb.zip chromium_src-207839e902dda33120835cf135dee8649a151ceb.tar.gz chromium_src-207839e902dda33120835cf135dee8649a151ceb.tar.bz2 |
Revert 159787 (apparently added 2 static initializers)
- bookmarks: Centralize bookmark bar constants in a single place.
BUG=136247
TEST=attach, deattach the bookmark bar, it should look sane. No visual regressions.
R=sky@chromium.org
Review URL: https://codereview.chromium.org/11008018
TBR=tfarina@chromium.org
Review URL: https://codereview.chromium.org/11033020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160046 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
16 files changed, 74 insertions, 111 deletions
diff --git a/chrome/browser/defaults.cc b/chrome/browser/defaults.cc index 04125b5..f99d19b 100644 --- a/chrome/browser/defaults.cc +++ b/chrome/browser/defaults.cc @@ -95,6 +95,9 @@ const bool kBrowserAliveWithNoWindows = true; const bool kBrowserAliveWithNoWindows = false; #endif +const int kBookmarkBarHeight = 28; +const int kNewtabBookmarkBarHeight = 57; + const ui::ResourceBundle::FontStyle kAssociatedNetworkFontStyle = ui::ResourceBundle::BoldFont; diff --git a/chrome/browser/defaults.h b/chrome/browser/defaults.h index 8386eb2..ac0e068 100644 --- a/chrome/browser/defaults.h +++ b/chrome/browser/defaults.h @@ -71,6 +71,11 @@ extern const bool kAlwaysOpenIncognitoWindow; // Should the close button be shown in the Task Manager dialog? extern const bool kShowCancelButtonInTaskManager; +// Preferred height of the bookmarks bar when shown on every page and +// when shown only on the new tab page. +extern const int kBookmarkBarHeight; +extern const int kNewtabBookmarkBarHeight; + // ChromiumOS network menu font extern const ui::ResourceBundle::FontStyle kAssociatedNetworkFontStyle; diff --git a/chrome/browser/ui/bookmarks/bookmark_ui_constants.cc b/chrome/browser/ui/bookmarks/bookmark_ui_constants.cc deleted file mode 100644 index 3e9c8a7..0000000 --- a/chrome/browser/ui/bookmarks/bookmark_ui_constants.cc +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" - -#include "build/build_config.h" - -namespace chrome { - -#if defined(OS_WIN) || defined(TOOLKIT_VIEWS) -const int kBookmarkBarHeight = 28; -#elif defined(OS_MACOSX) -// This is actually a little smaller than it should be -// (by |kVisualHeightOffset| points) because of the visual overlap with the main -// toolbar. When using this to compute values other than the actual height of -// the toolbar, be sure to add |kVisualHeightOffset|. -const int kBookmarkBarHeight = 26; -#elif defined(TOOLKIT_GTK) -const int kBookmarkBarHeight = 29; -#endif - -#if defined(OS_WIN) || defined(TOOLKIT_VIEWS) -const int kNTPBookmarkBarHeight = 57; -#elif defined(OS_MACOSX) -const int kNTPBookmarkBarHeight = 40; -#elif defined(TOOLKIT_GTK) -const int kNTPBookmarkBarHeight = 57; -#endif - -} // namespace chrome diff --git a/chrome/browser/ui/bookmarks/bookmark_ui_constants.h b/chrome/browser/ui/bookmarks/bookmark_ui_constants.h deleted file mode 100644 index fd773977..0000000 --- a/chrome/browser/ui/bookmarks/bookmark_ui_constants.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UI_CONSTANTS_H_ -#define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UI_CONSTANTS_H_ - -namespace chrome { - -// The Bookmark bar height, when opened in "always visible" mode. -extern const int kBookmarkBarHeight; - -// The Bookmark bar height, when visible in "new tab page" mode. -extern const int kNTPBookmarkBarHeight; - -} // namespace chrome - -#endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_UI_CONSTANTS_H_ diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h index e6222df..5559de7 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h @@ -9,26 +9,35 @@ #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONSTANTS_H_ #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONSTANTS_H_ -#import <Cocoa/Cocoa.h> - namespace bookmarks { // Correction used for computing other values based on the height. -extern const int kVisualHeightOffset; +const int kVisualHeightOffset = 2; + +// Bar height, when opened in "always visible" mode. This is actually a little +// smaller than it should be (by |kVisualHeightOffset| points) because of the +// visual overlap with the main toolbar. When using this to compute values +// other than the actual height of the toolbar, be sure to add +// |kVisualHeightOffset|. +const int kBookmarkBarHeight = 26; + +// Our height, when visible in "new tab page" mode. +const int kNTPBookmarkBarHeight = 40; // The amount of space between the inner bookmark bar and the outer toolbar on // new tab pages. -extern const int kNTPBookmarkBarPadding; +const int kNTPBookmarkBarPadding = + (kNTPBookmarkBarHeight - (kBookmarkBarHeight + kVisualHeightOffset)) / 2; // The height of buttons in the bookmark bar. -extern const int kBookmarkButtonHeight; +const int kBookmarkButtonHeight = kBookmarkBarHeight + kVisualHeightOffset; // The height of buttons in a bookmark bar folder menu. -extern const CGFloat kBookmarkFolderButtonHeight; +const CGFloat kBookmarkFolderButtonHeight = 24.0; // The radius of the corner curves on the menu. Also used for sizing the shadow // window behind the menu window at times when the menu can be scrolled. -extern const CGFloat kBookmarkBarMenuCornerRadius; +const CGFloat kBookmarkBarMenuCornerRadius = 4.0; } // namespace bookmarks diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.mm deleted file mode 100644 index 1bd402e..0000000 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.mm +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" - -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" - -namespace bookmarks { - -const int kVisualHeightOffset = 2; - -const int kNTPBookmarkBarPadding = (chrome::kNTPBookmarkBarHeight - - (chrome::kBookmarkBarHeight + kVisualHeightOffset)) / 2; - -const int kBookmarkButtonHeight = chrome::kBookmarkBarHeight + - kVisualHeightOffset; - -const CGFloat kBookmarkFolderButtonHeight = 24.0; - -const CGFloat kBookmarkBarMenuCornerRadius = 4.0; - -} // namespace bookmarks diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm index a1c9e8f..a270431 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm @@ -18,7 +18,6 @@ #include "chrome/browser/profiles/profile.h" #import "chrome/browser/themes/theme_service.h" #import "chrome/browser/themes/theme_service_factory.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" @@ -1009,7 +1008,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { AnimatableView* view = [self animatableView]; // Height takes into account the extra height we have since the toolbar // only compresses when we're done. - [view animateToNewHeight:(chrome::kBookmarkBarHeight - + [view animateToNewHeight:(bookmarks::kBookmarkBarHeight - kBookmarkBarOverlap) duration:kBookmarkBarAnimationDuration]; } else if ([self isAnimatingFromState:bookmarks::kShowingState @@ -1024,7 +1023,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { [[self backgroundGradientView] setShowsDivider:YES]; [[self view] setHidden:NO]; AnimatableView* view = [self animatableView]; - [view animateToNewHeight:chrome::kNTPBookmarkBarHeight + [view animateToNewHeight:bookmarks::kNTPBookmarkBarHeight duration:kBookmarkBarAnimationDuration]; } else if ([self isAnimatingFromState:bookmarks::kDetachedState toState:bookmarks::kShowingState]) { @@ -1033,7 +1032,7 @@ void RecordAppLaunch(Profile* profile, GURL url) { AnimatableView* view = [self animatableView]; // Height takes into account the extra height we have since the toolbar // only compresses when we're done. - [view animateToNewHeight:(chrome::kBookmarkBarHeight - + [view animateToNewHeight:(bookmarks::kBookmarkBarHeight - kBookmarkBarOverlap) duration:kBookmarkBarAnimationDuration]; } else { @@ -1156,9 +1155,9 @@ void RecordAppLaunch(Profile* profile, GURL url) { switch (visualState_) { case bookmarks::kShowingState: - return chrome::kBookmarkBarHeight; + return bookmarks::kBookmarkBarHeight; case bookmarks::kDetachedState: - return chrome::kNTPBookmarkBarHeight; + return bookmarks::kNTPBookmarkBarHeight; case bookmarks::kHiddenState: return 0; case bookmarks::kInvalidState: diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm index 7c50633..cbb7bc8 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller_unittest.mm @@ -15,7 +15,6 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/extensions/test_extension_system.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #import "chrome/browser/ui/cocoa/animation_utils.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" @@ -1032,8 +1031,8 @@ TEST_F(BookmarkBarControllerTest, BookmarkButtonSizing) { EXPECT_GT([buttons count], 0u); for (NSButton* button in buttons) { EXPECT_FLOAT_EQ( - (chrome::kBookmarkBarHeight + bookmarks::kVisualHeightOffset) - 2 * - bookmarks::kBookmarkVerticalPadding, + (bookmarks::kBookmarkBarHeight + bookmarks::kVisualHeightOffset) - 2 * + bookmarks::kBookmarkVerticalPadding, [button frame].size.height); } } diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm index 026dadd..863a652 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm @@ -9,7 +9,6 @@ #include "base/sys_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_button_cell.h" @@ -1948,7 +1947,7 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { // If this button is showing its menu then we need to move the menu, too. if (aButton == subButton) [folderController_ offsetFolderMenuWindow:NSMakeSize(0.0, - chrome::kBookmarkBarHeight)]; + bookmarks::kBookmarkBarHeight)]; } } else { // If all nodes have been removed from this folder then add in the diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm index dcfadf9a..8fcfb19 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller_unittest.mm @@ -9,7 +9,6 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #import "chrome/browser/ui/cocoa/animation_utils.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" @@ -169,8 +168,8 @@ class BookmarkBarFolderControllerTest : public CocoaProfileTest { // Make parent frame for bookmark bar then open it. NSRect frame = [[test_window() contentView] frame]; frame = NSMakeRect(frame.origin.x, - frame.size.height - chrome::kNTPBookmarkBarHeight, - frame.size.width, chrome::kNTPBookmarkBarHeight); + frame.size.height - bookmarks::kNTPBookmarkBarHeight, + frame.size.width, bookmarks::kNTPBookmarkBarHeight); NSView* fakeToolbarView = [[[NSView alloc] initWithFrame:frame] autorelease]; [[test_window() contentView] addSubview:fakeToolbarView]; diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm index 80cffdf..1d0aef8 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.mm @@ -6,7 +6,6 @@ #include "chrome/browser/ntp_background_util.h" #include "chrome/browser/themes/theme_service.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 896e369..af1f926 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -20,7 +20,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/tab_contents/thumbnail_generator.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #include "chrome/browser/ui/cocoa/animation_utils.h" #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" @@ -246,7 +245,7 @@ void ThumbnailLoader::LoadThumbnail() { bookmark_tab_helper->ShouldShowBookmarkBar() && !always_show_bookmark_bar; if (has_detached_bookmark_bar) - topOffset += chrome::kNTPBookmarkBarHeight; + topOffset += bookmarks::kNTPBookmarkBarHeight; return topOffset; } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index 2dccdf9..fdb4634 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -20,7 +20,6 @@ #include "chrome/browser/ntp_background_util.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" @@ -67,6 +66,9 @@ using content::WebContents; namespace { +// The showing height of the bar. +const int kBookmarkBarHeight = 29; + // Padding for when the bookmark bar is detached. const int kTopBottomNTPPadding = 12; const int kLeftRightNTPPadding = 8; @@ -131,6 +133,8 @@ void RecordAppLaunch(Profile* profile, const GURL& url) { } // namespace +const int BookmarkBarGtk::kBookmarkBarNTPHeight = 57; + BookmarkBarGtk::BookmarkBarGtk(BrowserWindowGtk* window, Browser* browser, TabstripOriginProvider* tabstrip_origin_provider) @@ -320,7 +324,7 @@ void BookmarkBarGtk::CalculateMaxHeight() { max_height_ = req.height; } else { max_height_ = (bookmark_bar_state_ == BookmarkBar::DETACHED) ? - chrome::kNTPBookmarkBarHeight : chrome::kBookmarkBarHeight; + kBookmarkBarNTPHeight : kBookmarkBarHeight; } } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h index 774c076..f984d479 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h @@ -49,6 +49,9 @@ class BookmarkBarGtk : public ui::AnimationDelegate, public chrome::BookmarkBarInstructionsDelegate, public BookmarkContextMenuControllerDelegate { public: + // The NTP needs to have access to this. + static const int kBookmarkBarNTPHeight; + BookmarkBarGtk(BrowserWindowGtk* window, Browser* browser, TabstripOriginProvider* tabstrip_origin_provider); diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc index 5f77b8b..783bc37 100644 --- a/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc @@ -18,6 +18,7 @@ #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser_shutdown.h" +#include "chrome/browser/defaults.h" #include "chrome/browser/event_disposition.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/pref_service.h" @@ -26,7 +27,6 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_tabstrip.h" @@ -609,7 +609,7 @@ gfx::Size BookmarkBarView::GetMinimumSize() { overflow_pref.width() + kButtonPadding + bookmarks_separator_pref.width(); - return gfx::Size(width, chrome::kBookmarkBarHeight); + return gfx::Size(width, browser_defaults::kBookmarkBarHeight); } void BookmarkBarView::Layout() { @@ -1585,8 +1585,8 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { // For the attached appearance, pin the content to the bottom of the bar // when animating in/out, as shrinking its height instead looks weird. This // also matches how we layout infobars. - y += View::height() - chrome::kBookmarkBarHeight; - height += chrome::kBookmarkBarHeight; + y += View::height() - browser_defaults::kBookmarkBarHeight; + height += browser_defaults::kBookmarkBarHeight; } gfx::Size other_bookmarked_pref = other_bookmarked_button_->visible() ? @@ -1675,13 +1675,16 @@ gfx::Size BookmarkBarView::LayoutItems(bool compute_bounds_only) { x += static_cast<int>( kNewtabHorizontalPadding * (1 - size_animation_->GetCurrentValue())); prefsize.set_height( - chrome::kBookmarkBarHeight + + browser_defaults::kBookmarkBarHeight + static_cast<int>( - (chrome::kNTPBookmarkBarHeight - chrome::kBookmarkBarHeight) * + (browser_defaults::kNewtabBookmarkBarHeight - + browser_defaults::kBookmarkBarHeight) * (1 - size_animation_->GetCurrentValue()))); } else { - prefsize.set_height(static_cast<int>( - chrome::kBookmarkBarHeight * size_animation_->GetCurrentValue())); + prefsize.set_height( + static_cast<int>( + browser_defaults::kBookmarkBarHeight * + size_animation_->GetCurrentValue())); } } return prefsize; diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index 006f937..43ae74f 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -15,6 +15,7 @@ #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/browser/defaults.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/google/google_util.h" #include "chrome/browser/prefs/pref_service.h" @@ -23,7 +24,6 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" -#include "chrome/browser/ui/bookmarks/bookmark_ui_constants.h" #include "chrome/browser/ui/search/search.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" @@ -55,6 +55,12 @@ #include "ui/gfx/sys_color_change_listener.h" #if defined(OS_MACOSX) +#include "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" +#elif defined(TOOLKIT_GTK) +#include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" +#endif + +#if defined(OS_MACOSX) #include "chrome/browser/platform_util.h" #endif @@ -134,11 +140,19 @@ std::string GetNewTabBackgroundCSS(const ui::ThemeProvider* theme_provider, if (bar_attached) return ThemeService::AlignmentToString(alignment); - if (alignment & ThemeService::ALIGN_TOP) { - // The bar is detached, so we must offset the background by the bar size - // if it's a top-aligned bar. - int offset = chrome::kNTPBookmarkBarHeight; + // The bar is detached, so we must offset the background by the bar size + // if it's a top-aligned bar. +#if defined(OS_WIN) || defined(TOOLKIT_VIEWS) + int offset = browser_defaults::kNewtabBookmarkBarHeight; +#elif defined(OS_MACOSX) + int offset = bookmarks::kNTPBookmarkBarHeight; +#elif defined(TOOLKIT_GTK) + int offset = BookmarkBarGtk::kBookmarkBarNTPHeight; +#else + int offset = 0; +#endif + if (alignment & ThemeService::ALIGN_TOP) { if (alignment & ThemeService::ALIGN_LEFT) return "left " + base::IntToString(-offset) + "px"; else if (alignment & ThemeService::ALIGN_RIGHT) |