| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/app_launcher.h" | 10 #include "apps/app_launcher.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "grit/theme_resources.h" | 53 #include "grit/theme_resources.h" |
| 54 #include "ui/base/animation/animation.h" | 54 #include "ui/base/animation/animation.h" |
| 55 #include "ui/base/l10n/l10n_util.h" | 55 #include "ui/base/l10n/l10n_util.h" |
| 56 #include "ui/base/resource/resource_bundle.h" | 56 #include "ui/base/resource/resource_bundle.h" |
| 57 #include "ui/base/theme_provider.h" | 57 #include "ui/base/theme_provider.h" |
| 58 #include "ui/gfx/color_utils.h" | 58 #include "ui/gfx/color_utils.h" |
| 59 #include "ui/gfx/sys_color_change_listener.h" | 59 #include "ui/gfx/sys_color_change_listener.h" |
| 60 #include "ui/webui/jstemplate_builder.h" | 60 #include "ui/webui/jstemplate_builder.h" |
| 61 #include "ui/webui/web_ui_util.h" | 61 #include "ui/webui/web_ui_util.h" |
| 62 | 62 |
| 63 #if defined(OS_CHROMEOS) | |
| 64 #include "chromeos/chromeos_switches.h" | |
| 65 #endif | |
| 66 | |
| 67 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 68 #include "chrome/browser/platform_util.h" | 64 #include "chrome/browser/platform_util.h" |
| 69 #endif | 65 #endif |
| 70 | 66 |
| 71 using content::BrowserThread; | 67 using content::BrowserThread; |
| 72 | 68 |
| 73 namespace { | 69 namespace { |
| 74 | 70 |
| 75 // The URL for the the Learn More page shown on incognito new tab. | 71 // The URL for the the Learn More page shown on incognito new tab. |
| 76 const char kLearnMoreIncognitoUrl[] = | 72 const char kLearnMoreIncognitoUrl[] = |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 272 |
| 277 void NTPResourceCache::CreateNewTabIncognitoHTML() { | 273 void NTPResourceCache::CreateNewTabIncognitoHTML() { |
| 278 DictionaryValue localized_strings; | 274 DictionaryValue localized_strings; |
| 279 localized_strings.SetString("title", | 275 localized_strings.SetString("title", |
| 280 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 276 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 281 int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; | 277 int new_tab_message_ids = IDS_NEW_TAB_OTR_MESSAGE; |
| 282 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; | 278 int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; |
| 283 const char* new_tab_link = kLearnMoreIncognitoUrl; | 279 const char* new_tab_link = kLearnMoreIncognitoUrl; |
| 284 // TODO(altimofeev): consider implementation without 'if def' usage. | 280 // TODO(altimofeev): consider implementation without 'if def' usage. |
| 285 #if defined(OS_CHROMEOS) | 281 #if defined(OS_CHROMEOS) |
| 286 if (CommandLine::ForCurrentProcess()->HasSwitch( | 282 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession)) { |
| 287 chromeos::switches::kGuestSession)) { | |
| 288 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; | 283 new_tab_message_ids = IDS_NEW_TAB_GUEST_SESSION_MESSAGE; |
| 289 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; | 284 new_tab_html_idr = IDR_GUEST_SESSION_TAB_HTML; |
| 290 new_tab_link = kLearnMoreGuestSessionUrl; | 285 new_tab_link = kLearnMoreGuestSessionUrl; |
| 291 | 286 |
| 292 std::string enterprise_domain = | 287 std::string enterprise_domain = |
| 293 g_browser_process->browser_policy_connector()->GetEnterpriseDomain(); | 288 g_browser_process->browser_policy_connector()->GetEnterpriseDomain(); |
| 294 if (!enterprise_domain.empty()) { | 289 if (!enterprise_domain.empty()) { |
| 295 // Device is enterprise enrolled. | 290 // Device is enterprise enrolled. |
| 296 localized_strings.SetString("enterpriseInfoVisible", "true"); | 291 localized_strings.SetString("enterpriseInfoVisible", "true"); |
| 297 string16 enterprise_info = l10n_util::GetStringFUTF16( | 292 string16 enterprise_info = l10n_util::GetStringFUTF16( |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // Get our template. | 615 // Get our template. |
| 621 static const base::StringPiece new_tab_theme_css( | 616 static const base::StringPiece new_tab_theme_css( |
| 622 ResourceBundle::GetSharedInstance().GetRawDataResource( | 617 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 623 IDR_NEW_TAB_4_THEME_CSS)); | 618 IDR_NEW_TAB_4_THEME_CSS)); |
| 624 | 619 |
| 625 // Create the string from our template and the replacements. | 620 // Create the string from our template and the replacements. |
| 626 std::string css_string; | 621 std::string css_string; |
| 627 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 622 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 628 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 623 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 629 } | 624 } |
| OLD | NEW |