| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/ntp_resource_cache.h" | 5 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/animation.h" | 10 #include "app/animation.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "app/theme_provider.h" | 13 #include "app/theme_provider.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/ref_counted_memory.h" | 16 #include "base/ref_counted_memory.h" |
| 17 #include "base/string_number_conversions.h" |
| 17 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "chrome/browser/browser_theme_provider.h" | 20 #include "chrome/browser/browser_theme_provider.h" |
| 20 #include "chrome/browser/chrome_thread.h" | 21 #include "chrome/browser/chrome_thread.h" |
| 21 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 22 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 22 #include "chrome/browser/google_util.h" | 23 #include "chrome/browser/google_util.h" |
| 23 #include "chrome/browser/pref_service.h" | 24 #include "chrome/browser/pref_service.h" |
| 24 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 #elif defined(OS_MACOSX) | 98 #elif defined(OS_MACOSX) |
| 98 int offset = bookmarks::kNTPBookmarkBarHeight; | 99 int offset = bookmarks::kNTPBookmarkBarHeight; |
| 99 #elif defined(OS_POSIX) | 100 #elif defined(OS_POSIX) |
| 100 int offset = BookmarkBarGtk::kBookmarkBarNTPHeight; | 101 int offset = BookmarkBarGtk::kBookmarkBarNTPHeight; |
| 101 #else | 102 #else |
| 102 int offset = 0; | 103 int offset = 0; |
| 103 #endif | 104 #endif |
| 104 | 105 |
| 105 if (alignment & BrowserThemeProvider::ALIGN_TOP) { | 106 if (alignment & BrowserThemeProvider::ALIGN_TOP) { |
| 106 if (alignment & BrowserThemeProvider::ALIGN_LEFT) | 107 if (alignment & BrowserThemeProvider::ALIGN_LEFT) |
| 107 return "0% " + IntToString(-offset) + "px"; | 108 return "0% " + base::IntToString(-offset) + "px"; |
| 108 else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) | 109 else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) |
| 109 return "100% " + IntToString(-offset) + "px"; | 110 return "100% " + base::IntToString(-offset) + "px"; |
| 110 return "center " + IntToString(-offset) + "px"; | 111 return "center " + base::IntToString(-offset) + "px"; |
| 111 } | 112 } |
| 112 return BrowserThemeProvider::AlignmentToString(alignment); | 113 return BrowserThemeProvider::AlignmentToString(alignment); |
| 113 } | 114 } |
| 114 | 115 |
| 115 // How the background image on the new tab page should be tiled (see tiling | 116 // How the background image on the new tab page should be tiled (see tiling |
| 116 // masks in browser_theme_provider.h). | 117 // masks in browser_theme_provider.h). |
| 117 std::string GetNewTabBackgroundTilingCSS(const ThemeProvider* theme_provider) { | 118 std::string GetNewTabBackgroundTilingCSS(const ThemeProvider* theme_provider) { |
| 118 int repeat_mode; | 119 int repeat_mode; |
| 119 theme_provider->GetDisplayProperty( | 120 theme_provider->GetDisplayProperty( |
| 120 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); | 121 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Create the string from our template and the replacements. | 451 // Create the string from our template and the replacements. |
| 451 const std::string css_string = ReplaceStringPlaceholders( | 452 const std::string css_string = ReplaceStringPlaceholders( |
| 452 new_tab_theme_css, subst, NULL); | 453 new_tab_theme_css, subst, NULL); |
| 453 std::string full_css = ReplaceStringPlaceholders(css_string, subst2, NULL); | 454 std::string full_css = ReplaceStringPlaceholders(css_string, subst2, NULL); |
| 454 | 455 |
| 455 new_tab_css_ = new RefCountedBytes; | 456 new_tab_css_ = new RefCountedBytes; |
| 456 new_tab_css_->data.resize(full_css.size()); | 457 new_tab_css_->data.resize(full_css.size()); |
| 457 std::copy(full_css.begin(), full_css.end(), | 458 std::copy(full_css.begin(), full_css.end(), |
| 458 new_tab_css_->data.begin()); | 459 new_tab_css_->data.begin()); |
| 459 } | 460 } |
| OLD | NEW |