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/ntp/ntp_resource_cache.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 468 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
469 } | 469 } |
470 | 470 |
471 string16 NTPResourceCache::GetSyncTypeMessage() { | 471 string16 NTPResourceCache::GetSyncTypeMessage() { |
472 if (profile_->HasProfileSyncService()) { | 472 if (profile_->HasProfileSyncService()) { |
473 syncable::ModelTypeBitSet unacknowledged = | 473 syncable::ModelTypeBitSet unacknowledged = |
474 profile_->GetProfileSyncService()->GetUnacknowledgedTypes(); | 474 profile_->GetProfileSyncService()->GetUnacknowledgedTypes(); |
475 | 475 |
476 // TODO(sync): As we add new data types, we'll probably need some more | 476 // TODO(sync): As we add new data types, we'll probably need some more |
477 // generic string to display to the user, since the method below won't | 477 // generic string to display to the user, since the method below won't |
478 // scale indefinitely (we'd need N*(N+1)/2 different strings to represent | 478 // scale indefinitely (we'd need N*(N+1)/2 different strings to represent |
Ben Olmstead
2011/08/31 17:36:43
N*(N+1)/2 should be 2^N-1
| |
479 // all the combinations of unacknowledged types). But for now, we just | 479 // all the combinations of unacknowledged types). But for now, we just |
480 // have sessions and typed urls so this is OK. | 480 // have sessions and typed urls so this is OK. |
481 if (unacknowledged.test(syncable::SESSIONS) && | 481 if (unacknowledged.test(syncable::SESSIONS) && |
482 unacknowledged.test(syncable::TYPED_URLS)) { | 482 unacknowledged.test(syncable::TYPED_URLS)) { |
483 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_SESSIONS_AND_TYPED_URLS); | 483 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_SESSIONS_AND_TYPED_URLS); |
484 } else if (unacknowledged.test(syncable::SESSIONS)) { | 484 } else if (unacknowledged.test(syncable::SESSIONS)) { |
485 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_SESSIONS); | 485 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_SESSIONS); |
486 } else if (unacknowledged.test(syncable::TYPED_URLS)) { | 486 } else if (unacknowledged.test(syncable::TYPED_URLS)) { |
487 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_TYPED_URLS); | 487 return l10n_util::GetStringUTF16(IDS_SYNC_ADDED_TYPED_URLS); |
488 } else if (unacknowledged.test(syncable::EXTENSION_SETTINGS)) { | |
489 LOG(ERROR) << "Unacknowledged extension settings. TODO(kalman): what?"; | |
not at google - send to devlin
2011/08/29 09:07:45
TODO(kalman) indeed. I presume something more tha
| |
488 } else { | 490 } else { |
489 // Shouldn't be possible for any other types to be unacknowledged. | 491 // Shouldn't be possible for any other types to be unacknowledged. |
490 CHECK(!unacknowledged.any()); | 492 CHECK(!unacknowledged.any()); |
491 } | 493 } |
492 } | 494 } |
493 return string16(); | 495 return string16(); |
494 } | 496 } |
495 | 497 |
496 void NTPResourceCache::CreateNewTabIncognitoCSS() { | 498 void NTPResourceCache::CreateNewTabIncognitoCSS() { |
497 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 499 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; | 615 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
614 static const base::StringPiece new_tab_theme_css( | 616 static const base::StringPiece new_tab_theme_css( |
615 ResourceBundle::GetSharedInstance().GetRawDataResource( | 617 ResourceBundle::GetSharedInstance().GetRawDataResource( |
616 ntp_css_resource_id)); | 618 ntp_css_resource_id)); |
617 | 619 |
618 // Create the string from our template and the replacements. | 620 // Create the string from our template and the replacements. |
619 std::string css_string; | 621 std::string css_string; |
620 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 622 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
621 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 623 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
622 } | 624 } |
OLD | NEW |