OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/views/bookmarks/bookmark_bar_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/sync/profile_sync_service.h" | 26 #include "chrome/browser/sync/profile_sync_service.h" |
27 #include "chrome/browser/sync/profile_sync_service_factory.h" | 27 #include "chrome/browser/sync/profile_sync_service_factory.h" |
28 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
29 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 29 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
30 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 30 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 31 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
32 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
33 #include "chrome/browser/ui/browser_tabstrip.h" | 33 #include "chrome/browser/ui/browser_tabstrip.h" |
34 #include "chrome/browser/ui/chrome_pages.h" | 34 #include "chrome/browser/ui/chrome_pages.h" |
35 #include "chrome/browser/ui/search/search_model.h" | 35 #include "chrome/browser/ui/search/search_model.h" |
| 36 #include "chrome/browser/ui/search/search_ui.h" |
36 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 37 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
37 #include "chrome/browser/ui/view_ids.h" | 38 #include "chrome/browser/ui/view_ids.h" |
38 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" | 39 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
39 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" | 40 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
40 #include "chrome/browser/ui/views/event_utils.h" | 41 #include "chrome/browser/ui/views/event_utils.h" |
41 #include "chrome/browser/ui/views/frame/browser_view.h" | 42 #include "chrome/browser/ui/views/frame/browser_view.h" |
42 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 43 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
43 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 44 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
44 #include "chrome/common/chrome_notification_types.h" | 45 #include "chrome/common/chrome_notification_types.h" |
45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 DCHECK(profile->GetExtensionService()); | 317 DCHECK(profile->GetExtensionService()); |
317 if (!profile->GetExtensionService()->IsInstalledApp(url)) | 318 if (!profile->GetExtensionService()->IsInstalledApp(url)) |
318 return; | 319 return; |
319 | 320 |
320 AppLauncherHandler::RecordAppLaunchType( | 321 AppLauncherHandler::RecordAppLaunchType( |
321 extension_misc::APP_LAUNCH_BOOKMARK_BAR); | 322 extension_misc::APP_LAUNCH_BOOKMARK_BAR); |
322 } | 323 } |
323 | 324 |
324 int GetSearchNtpMargin(int full_width) { | 325 int GetSearchNtpMargin(int full_width) { |
325 // Horizontally center bookmark bar. | 326 // Horizontally center bookmark bar. |
326 const int kMaxNtpBookmarkBarWidth = 720; | 327 int width = |
327 const int kNtpBookmarkBarWidthPadding = 130; | 328 full_width - 2 * chrome::search::kHorizontalPaddingForBottomBookmarkBar; |
328 int width = full_width - 2 * kNtpBookmarkBarWidthPadding; | 329 if (width > chrome::search::kMaxWidthForBottomBookmarkBar) |
329 if (width > kMaxNtpBookmarkBarWidth) | 330 width = chrome::search::kMaxWidthForBottomBookmarkBar; |
330 width = kMaxNtpBookmarkBarWidth; | |
331 return (full_width - width) / 2; | 331 return (full_width - width) / 2; |
332 } | 332 } |
333 | 333 |
334 int GetNtpHorizontalPadding(const chrome::search::Mode& search_mode, | 334 int GetNtpHorizontalPadding(const chrome::search::Mode& search_mode, |
335 bool is_detached) { | 335 bool is_detached) { |
336 return search_mode.is_ntp() && is_detached ? kSearchNewtabHorizontalPadding : | 336 return search_mode.is_ntp() && is_detached ? kSearchNewtabHorizontalPadding : |
337 BookmarkBarView::kNewtabHorizontalPadding; | 337 BookmarkBarView::kNewtabHorizontalPadding; |
338 } | 338 } |
339 | 339 |
340 } // namespace | 340 } // namespace |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 (1 - size_animation_->GetCurrentValue()))); | 1799 (1 - size_animation_->GetCurrentValue()))); |
1800 } else { | 1800 } else { |
1801 prefsize.set_height( | 1801 prefsize.set_height( |
1802 static_cast<int>( | 1802 static_cast<int>( |
1803 browser_defaults::kBookmarkBarHeight * | 1803 browser_defaults::kBookmarkBarHeight * |
1804 size_animation_->GetCurrentValue())); | 1804 size_animation_->GetCurrentValue())); |
1805 } | 1805 } |
1806 } | 1806 } |
1807 return prefsize; | 1807 return prefsize; |
1808 } | 1808 } |
OLD | NEW |