| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/browser.h" | |
| 19 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
| 20 #include "chrome/browser/ui/browser_instant_controller.h" | 19 #include "chrome/browser/ui/browser_instant_controller.h" |
| 21 #include "chrome/browser/ui/search/instant_controller.h" | 20 #include "chrome/browser/ui/search/instant_controller.h" |
| 22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
| 24 #include "components/pref_registry/pref_registry_syncable.h" | 23 #include "components/pref_registry/pref_registry_syncable.h" |
| 25 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
| 26 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
| 27 #include "content/public/browser/web_ui_data_source.h" | 26 #include "content/public/browser/web_ui_data_source.h" |
| 28 #include "content/public/browser/web_ui_message_handler.h" | 27 #include "content/public/browser/web_ui_message_handler.h" |
| 29 #include "grit/browser_resources.h" | 28 #include "grit/browser_resources.h" |
| 30 | 29 |
| 30 #if !defined(OS_ANDROID) |
| 31 #include "chrome/browser/ui/browser.h" |
| 32 #endif |
| 33 |
| 31 namespace { | 34 namespace { |
| 32 | 35 |
| 33 content::WebUIDataSource* CreateInstantHTMLSource() { | 36 content::WebUIDataSource* CreateInstantHTMLSource() { |
| 34 content::WebUIDataSource* source = | 37 content::WebUIDataSource* source = |
| 35 content::WebUIDataSource::Create(chrome::kChromeUIInstantHost); | 38 content::WebUIDataSource::Create(chrome::kChromeUIInstantHost); |
| 36 source->SetJsonPath("strings.js"); | 39 source->SetJsonPath("strings.js"); |
| 37 source->AddResourcePath("instant.js", IDR_INSTANT_JS); | 40 source->AddResourcePath("instant.js", IDR_INSTANT_JS); |
| 38 source->AddResourcePath("instant.css", IDR_INSTANT_CSS); | 41 source->AddResourcePath("instant.css", IDR_INSTANT_CSS); |
| 39 source->SetDefaultResource(IDR_INSTANT_HTML); | 42 source->SetDefaultResource(IDR_INSTANT_HTML); |
| 40 return source; | 43 return source; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 Profile* profile = Profile::FromWebUI(web_ui); | 179 Profile* profile = Profile::FromWebUI(web_ui); |
| 177 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); | 180 content::WebUIDataSource::Add(profile, CreateInstantHTMLSource()); |
| 178 } | 181 } |
| 179 | 182 |
| 180 // static | 183 // static |
| 181 void InstantUI::RegisterProfilePrefs( | 184 void InstantUI::RegisterProfilePrefs( |
| 182 user_prefs::PrefRegistrySyncable* registry) { | 185 user_prefs::PrefRegistrySyncable* registry) { |
| 183 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, | 186 registry->RegisterStringPref(prefs::kInstantUIZeroSuggestUrlPrefix, |
| 184 std::string()); | 187 std::string()); |
| 185 } | 188 } |
| OLD | NEW |