| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/dom_ui/new_tab_ui.h" | 7 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 first_view_ = false; | 414 first_view_ = false; |
| 415 | 415 |
| 416 // Control fade and resize animations. | 416 // Control fade and resize animations. |
| 417 std::wstring anim = | 417 std::wstring anim = |
| 418 Animation::ShouldRenderRichAnimation() ? L"true" : L"false"; | 418 Animation::ShouldRenderRichAnimation() ? L"true" : L"false"; |
| 419 localized_strings.SetString(L"anim", anim); | 419 localized_strings.SetString(L"anim", anim); |
| 420 | 420 |
| 421 // In case we have the new new tab page enabled we first try to read the file | 421 // In case we have the new new tab page enabled we first try to read the file |
| 422 // provided on the command line. If that fails we just get the resource from | 422 // provided on the command line. If that fails we just get the resource from |
| 423 // the resource bundle. | 423 // the resource bundle. |
| 424 StringPiece new_tab_html; | 424 base::StringPiece new_tab_html; |
| 425 std::string new_tab_html_str; | 425 std::string new_tab_html_str; |
| 426 new_tab_html_str = GetCustomNewTabPageFromCommandLine(); | 426 new_tab_html_str = GetCustomNewTabPageFromCommandLine(); |
| 427 | 427 |
| 428 if (!new_tab_html_str.empty()) { | 428 if (!new_tab_html_str.empty()) { |
| 429 new_tab_html = StringPiece(new_tab_html_str); | 429 new_tab_html = base::StringPiece(new_tab_html_str); |
| 430 } | 430 } |
| 431 | 431 |
| 432 if (new_tab_html.empty()) { | 432 if (new_tab_html.empty()) { |
| 433 new_tab_html = ResourceBundle::GetSharedInstance().GetRawDataResource( | 433 new_tab_html = ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 434 NewTabUI::UseOldNewTabPage() ? | 434 NewTabUI::UseOldNewTabPage() ? |
| 435 IDR_NEW_TAB_HTML : | 435 IDR_NEW_TAB_HTML : |
| 436 IDR_NEW_NEW_TAB_HTML); | 436 IDR_NEW_NEW_TAB_HTML); |
| 437 } | 437 } |
| 438 | 438 |
| 439 full_html_.assign(new_tab_html.data(), new_tab_html.size()); | 439 full_html_.assign(new_tab_html.data(), new_tab_html.size()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 localized_strings.SetString(L"title", | 503 localized_strings.SetString(L"title", |
| 504 l10n_util::GetString(IDS_NEW_TAB_TITLE)); | 504 l10n_util::GetString(IDS_NEW_TAB_TITLE)); |
| 505 localized_strings.SetString(L"content", | 505 localized_strings.SetString(L"content", |
| 506 l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, | 506 l10n_util::GetStringF(IDS_NEW_TAB_OTR_MESSAGE, |
| 507 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); | 507 l10n_util::GetString(IDS_LEARN_MORE_INCOGNITO_URL))); |
| 508 localized_strings.SetString(L"bookmarkbarattached", | 508 localized_strings.SetString(L"bookmarkbarattached", |
| 509 bookmark_bar_attached_ ? "true" : "false"); | 509 bookmark_bar_attached_ ? "true" : "false"); |
| 510 | 510 |
| 511 SetFontAndTextDirection(&localized_strings); | 511 SetFontAndTextDirection(&localized_strings); |
| 512 | 512 |
| 513 static const StringPiece incognito_tab_html( | 513 static const base::StringPiece incognito_tab_html( |
| 514 ResourceBundle::GetSharedInstance().GetRawDataResource( | 514 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 515 IDR_INCOGNITO_TAB_HTML)); | 515 IDR_INCOGNITO_TAB_HTML)); |
| 516 | 516 |
| 517 full_html_ = jstemplate_builder::GetI18nTemplateHtml(incognito_tab_html, | 517 full_html_ = jstemplate_builder::GetI18nTemplateHtml(incognito_tab_html, |
| 518 &localized_strings); | 518 &localized_strings); |
| 519 } | 519 } |
| 520 | 520 |
| 521 /////////////////////////////////////////////////////////////////////////////// | 521 /////////////////////////////////////////////////////////////////////////////// |
| 522 // MostVisitedPage | 522 // MostVisitedPage |
| 523 | 523 |
| (...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1727 bool NewTabUI::WebResourcesEnabled() { | 1727 bool NewTabUI::WebResourcesEnabled() { |
| 1728 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1728 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1729 return !command_line->HasSwitch(switches::kDisableWebResources); | 1729 return !command_line->HasSwitch(switches::kDisableWebResources); |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 // static | 1732 // static |
| 1733 bool NewTabUI::FirstRunDisabled() { | 1733 bool NewTabUI::FirstRunDisabled() { |
| 1734 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1734 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1735 return command_line->HasSwitch(switches::kDisableNewTabFirstRun); | 1735 return command_line->HasSwitch(switches::kDisableNewTabFirstRun); |
| 1736 } | 1736 } |
| OLD | NEW |