Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc

Issue 10387010: Select theme resources from ResourceBundle at requested scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include "base/memory/ref_counted_memory.h"
7 #include "base/string16.h" 8 #include "base/string16.h"
8 #include "base/string_piece.h" 9 #include "base/string_piece.h"
9 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
10 #include "base/values.h" 11 #include "base/values.h"
11 #include "base/memory/ref_counted_memory.h"
12 #include "chrome/browser/google/google_util.h" 12 #include "chrome/browser/google/google_util.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 14 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
15 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" 15 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
16 #include "chrome/common/jstemplate_builder.h" 16 #include "chrome/common/jstemplate_builder.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "grit/browser_resources.h" 19 #include "grit/browser_resources.h"
20 #include "grit/generated_resources.h" 20 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/layout.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 24
24 using content::BrowserThread; 25 using content::BrowserThread;
25 26
26 namespace { 27 namespace {
27 28
28 const char kLearnMoreIncognitoUrl[] = 29 const char kLearnMoreIncognitoUrl[] =
29 "https://www.google.com/support/chrome/bin/answer.py?answer=95464"; 30 "https://www.google.com/support/chrome/bin/answer.py?answer=95464";
30 31
31 } // namespace 32 } // namespace
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 localized_strings.SetString("mostvisited", 67 localized_strings.SetString("mostvisited",
67 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); 68 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED));
68 localized_strings.SetString("recentlyclosed", 69 localized_strings.SetString("recentlyclosed",
69 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); 70 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED));
70 71
71 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings); 72 NewTabPageHandler::GetLocalizedValues(profile_, &localized_strings);
72 73
73 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); 74 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings);
74 75
75 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). 76 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance().
76 GetRawDataResource(IDR_NEW_TAB_4_HTML)); 77 GetRawDataResource(IDR_NEW_TAB_4_HTML,
78 ui::SCALE_FACTOR_NONE));
77 79
78 const char* new_tab_link = kLearnMoreIncognitoUrl; 80 const char* new_tab_link = kLearnMoreIncognitoUrl;
79 string16 learnMoreLink = ASCIIToUTF16( 81 string16 learnMoreLink = ASCIIToUTF16(
80 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec()); 82 google_util::AppendGoogleLocaleParam(GURL(new_tab_link)).spec());
81 localized_strings.SetString("content", 83 localized_strings.SetString("content",
82 l10n_util::GetStringFUTF16(IDS_NEW_TAB_OTR_MESSAGE, learnMoreLink)); 84 l10n_util::GetStringFUTF16(IDS_NEW_TAB_OTR_MESSAGE, learnMoreLink));
83 85
84 // Load the new tab page appropriate for this build. 86 // Load the new tab page appropriate for this build.
85 std::string full_html; 87 std::string full_html;
86 88
(...skipping 12 matching lines...) Expand all
99 size_t after_offset = pos + template_data_placeholder.size(); 101 size_t after_offset = pos + template_data_placeholder.size();
100 full_html.append(new_tab_html.data() + after_offset, 102 full_html.append(new_tab_html.data() + after_offset,
101 new_tab_html.size() - after_offset); 103 new_tab_html.size() - after_offset);
102 } else { 104 } else {
103 NOTREACHED(); 105 NOTREACHED();
104 full_html.assign(new_tab_html.data(), new_tab_html.size()); 106 full_html.assign(new_tab_html.data(), new_tab_html.size());
105 } 107 }
106 108
107 new_tab_html_ = base::RefCountedString::TakeString(&full_html); 109 new_tab_html_ = base::RefCountedString::TakeString(&full_html);
108 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698