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/webui/ntp/ntp_resource_cache.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
6 | 6 |
7 #include "base/string16.h" | 7 #include "base/string16.h" |
8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 const char kLearnMoreIncognitoUrl[] = | 28 const char kLearnMoreIncognitoUrl[] = |
29 "https://www.google.com/support/chrome/bin/answer.py?answer=95464"; | 29 "https://www.google.com/support/chrome/bin/answer.py?answer=95464"; |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {} | 33 NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {} |
34 | 34 |
35 NTPResourceCache::~NTPResourceCache() {} | 35 NTPResourceCache::~NTPResourceCache() {} |
36 | 36 |
37 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { | 37 base::RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { |
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
39 // Android uses same html/css for incognito NTP and normal NTP | 39 // Android uses same html/css for incognito NTP and normal NTP |
40 if (!new_tab_html_.get()) | 40 if (!new_tab_html_.get()) |
41 CreateNewTabHTML(); | 41 CreateNewTabHTML(); |
42 return new_tab_html_.get(); | 42 return new_tab_html_.get(); |
43 } | 43 } |
44 | 44 |
45 RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) { | 45 base::RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) { |
46 // This is used for themes, which are not currently supported on Android. | 46 // This is used for themes, which are not currently supported on Android. |
47 NOTIMPLEMENTED(); | 47 NOTIMPLEMENTED(); |
48 return NULL; | 48 return NULL; |
49 } | 49 } |
50 | 50 |
51 void NTPResourceCache::Observe(int type, | 51 void NTPResourceCache::Observe(int type, |
52 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
53 const content::NotificationDetails& details) { | 53 const content::NotificationDetails& details) { |
54 // No notifications necessary in Android. | 54 // No notifications necessary in Android. |
55 } | 55 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 size_t after_offset = pos + template_data_placeholder.size(); | 99 size_t after_offset = pos + template_data_placeholder.size(); |
100 full_html.append(new_tab_html.data() + after_offset, | 100 full_html.append(new_tab_html.data() + after_offset, |
101 new_tab_html.size() - after_offset); | 101 new_tab_html.size() - after_offset); |
102 } else { | 102 } else { |
103 NOTREACHED(); | 103 NOTREACHED(); |
104 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 104 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
105 } | 105 } |
106 | 106 |
107 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 107 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
108 } | 108 } |
OLD | NEW |