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/instant_ui.h" | 5 #include "chrome/browser/ui/webui/instant_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 content::WebUIDataSource* CreateInstantHTMLSource() { | 26 content::WebUIDataSource* CreateInstantHTMLSource() { |
27 content::WebUIDataSource* source = | 27 content::WebUIDataSource* source = |
28 content::WebUIDataSource::Create(chrome::kChromeUIInstantHost); | 28 content::WebUIDataSource::Create(chrome::kChromeUIInstantHost); |
29 source->SetJsonPath("strings.js"); | 29 source->SetJsonPath("strings.js"); |
30 source->AddResourcePath("instant.js", IDR_INSTANT_JS); | 30 source->AddResourcePath("instant.js", IDR_INSTANT_JS); |
31 source->AddResourcePath("instant.css", IDR_INSTANT_CSS); | 31 source->AddResourcePath("instant.css", IDR_INSTANT_CSS); |
32 source->SetDefaultResource(IDR_INSTANT_HTML); | 32 source->SetDefaultResource(IDR_INSTANT_HTML); |
33 return source; | 33 return source; |
34 } | 34 } |
35 | 35 |
| 36 #if !defined(OS_ANDROID) |
36 std::string FormatTime(int64 time) { | 37 std::string FormatTime(int64 time) { |
37 base::Time::Exploded exploded; | 38 base::Time::Exploded exploded; |
38 base::Time::FromInternalValue(time).UTCExplode(&exploded); | 39 base::Time::FromInternalValue(time).UTCExplode(&exploded); |
39 return base::StringPrintf("%04d-%02d-%02d %02d:%02d:%02d.%03d", | 40 return base::StringPrintf("%04d-%02d-%02d %02d:%02d:%02d.%03d", |
40 exploded.year, exploded.month, exploded.day_of_month, | 41 exploded.year, exploded.month, exploded.day_of_month, |
41 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); | 42 exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
42 } | 43 } |
| 44 #endif // !defined(OS_ANDROID) |
43 | 45 |
44 // This class receives JavaScript messages from the renderer. | 46 // This class receives JavaScript messages from the renderer. |
45 // Note that the WebUI infrastructure runs on the UI thread, therefore all of | 47 // Note that the WebUI infrastructure runs on the UI thread, therefore all of |
46 // this class's methods are expected to run on the UI thread. | 48 // this class's methods are expected to run on the UI thread. |
47 class InstantUIMessageHandler | 49 class InstantUIMessageHandler |
48 : public content::WebUIMessageHandler, | 50 : public content::WebUIMessageHandler, |
49 public base::SupportsWeakPtr<InstantUIMessageHandler> { | 51 public base::SupportsWeakPtr<InstantUIMessageHandler> { |
50 public: | 52 public: |
51 InstantUIMessageHandler(); | 53 InstantUIMessageHandler(); |
52 virtual ~InstantUIMessageHandler(); | 54 virtual ~InstantUIMessageHandler(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 170 } |
169 | 171 |
170 // static | 172 // static |
171 void InstantUI::RegisterProfilePrefs( | 173 void InstantUI::RegisterProfilePrefs( |
172 user_prefs::PrefRegistrySyncable* registry) { | 174 user_prefs::PrefRegistrySyncable* registry) { |
173 registry->RegisterStringPref( | 175 registry->RegisterStringPref( |
174 prefs::kInstantUIZeroSuggestUrlPrefix, | 176 prefs::kInstantUIZeroSuggestUrlPrefix, |
175 std::string(), | 177 std::string(), |
176 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 178 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
177 } | 179 } |
OLD | NEW |