| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return new_tab_html_.get(); | 43 return new_tab_html_.get(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 base::RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) { | 46 base::RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) { |
| 47 // This is used for themes, which are not currently supported on Android. | 47 // This is used for themes, which are not currently supported on Android. |
| 48 NOTIMPLEMENTED(); | 48 NOTIMPLEMENTED(); |
| 49 return NULL; | 49 return NULL; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void NTPResourceCache::Observe(int type, | 52 void NTPResourceCache::Observe(int type, |
| 53 const content::NotificationSource& source, | 53 const content::NotificationSource& source, |
| 54 const content::NotificationDetails& details) { | 54 const content::NotificationDetails& details) { |
| 55 // No notifications necessary in Android. | 55 // No notifications necessary in Android. |
| 56 } | 56 } |
| 57 | 57 |
| 58 void NTPResourceCache::OnPreferenceChanged(PrefServiceBase* service, | 58 void NTPResourceCache::OnPreferenceChanged() { |
| 59 const std::string& pref_name) { | |
| 60 // No notifications necessary in Android. | 59 // No notifications necessary in Android. |
| 61 } | 60 } |
| 62 | 61 |
| 63 void NTPResourceCache::CreateNewTabHTML() { | 62 void NTPResourceCache::CreateNewTabHTML() { |
| 64 // TODO(estade): these strings should be defined in their relevant handlers | 63 // TODO(estade): these strings should be defined in their relevant handlers |
| 65 // (in GetLocalizedValues) and should have more legible names. | 64 // (in GetLocalizedValues) and should have more legible names. |
| 66 // Show the profile name in the title and most visited labels if the current | 65 // Show the profile name in the title and most visited labels if the current |
| 67 // profile is not the default. | 66 // profile is not the default. |
| 68 DictionaryValue localized_strings; | 67 DictionaryValue localized_strings; |
| 69 localized_strings.SetBoolean("hasattribution", false); | 68 localized_strings.SetBoolean("hasattribution", false); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 size_t after_offset = pos + template_data_placeholder.size(); | 133 size_t after_offset = pos + template_data_placeholder.size(); |
| 135 full_html.append(new_tab_html.data() + after_offset, | 134 full_html.append(new_tab_html.data() + after_offset, |
| 136 new_tab_html.size() - after_offset); | 135 new_tab_html.size() - after_offset); |
| 137 } else { | 136 } else { |
| 138 NOTREACHED(); | 137 NOTREACHED(); |
| 139 full_html.assign(new_tab_html.data(), new_tab_html.size()); | 138 full_html.assign(new_tab_html.data(), new_tab_html.size()); |
| 140 } | 139 } |
| 141 | 140 |
| 142 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 141 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
| 143 } | 142 } |
| OLD | NEW |