| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/aura/app_list_ui.h" | 5 #include "chrome/browser/ui/webui/aura/app_list_ui.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/google/google_util.h" | 8 #include "chrome/browser/google/google_util.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 11 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 12 #include "chrome/browser/ui/webui/aura/app_list_ui_delegate.h" | 12 #include "chrome/browser/ui/webui/aura/app_list_ui_delegate.h" |
| 13 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 13 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 14 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/browser/web_ui_message_handler.h" |
| 18 #include "grit/browser_resources.h" | 19 #include "grit/browser_resources.h" |
| 19 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 | 23 |
| 23 using content::WebContents; | 24 using content::WebContents; |
| 25 using content::WebUIMessageHandler; |
| 24 | 26 |
| 25 namespace { | 27 namespace { |
| 26 | 28 |
| 27 static const int kPageIdOffset = 10; | 29 static const int kPageIdOffset = 10; |
| 28 static const int kIndexMask = (1 << kPageIdOffset) - 1; | 30 static const int kIndexMask = (1 << kPageIdOffset) - 1; |
| 29 | 31 |
| 30 // TODO(xiyuan): Merge this with the one on ntp_resource_cache. | 32 // TODO(xiyuan): Merge this with the one on ntp_resource_cache. |
| 31 string16 GetUrlWithLang(const GURL& url) { | 33 string16 GetUrlWithLang(const GURL& url) { |
| 32 return ASCIIToUTF16(google_util::AppendGoogleLocaleParam(url).spec()); | 34 return ASCIIToUTF16(google_util::AppendGoogleLocaleParam(url).spec()); |
| 33 } | 35 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ExtensionService* service = GetProfile()->GetExtensionService(); | 127 ExtensionService* service = GetProfile()->GetExtensionService(); |
| 126 if (service) | 128 if (service) |
| 127 AddMessageHandler(new AppLauncherHandler(service)); | 129 AddMessageHandler(new AppLauncherHandler(service)); |
| 128 | 130 |
| 129 // Set up the source. | 131 // Set up the source. |
| 130 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 132 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
| 131 PrefService* prefs = profile->GetPrefs(); | 133 PrefService* prefs = profile->GetPrefs(); |
| 132 profile->GetChromeURLDataManager()->AddDataSource( | 134 profile->GetChromeURLDataManager()->AddDataSource( |
| 133 CreateAppListUIHTMLSource(prefs)); | 135 CreateAppListUIHTMLSource(prefs)); |
| 134 } | 136 } |
| OLD | NEW |