Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/shown_sections_handler.h" | 5 #include "chrome/browser/dom_ui/shown_sections_handler.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); | 86 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); |
| 87 | 87 |
| 88 if (old_mode != mode) { | 88 if (old_mode != mode) { |
| 89 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); | 89 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); |
| 90 pref_service_->SetInteger(prefs::kNTPShownSections, mode); | 90 pref_service_->SetInteger(prefs::kNTPShownSections, mode); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 // static | 94 // static |
| 95 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { | 95 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { |
| 96 #if defined(OS_CHROMEOS) | |
| 97 // Default to have expanded APPS and all other secions are minimized. | |
| 98 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, | |
| 99 APPS | MINIMIZED_THUMB | MINIMIZED_RECENT); | |
|
Dmitry Polukhin
2010/11/30 20:06:55
I think if no app are installed, it will show all
| |
| 100 #else | |
| 96 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, THUMB); | 101 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, THUMB); |
| 102 #endif | |
| 97 } | 103 } |
| 98 | 104 |
| 99 // static | 105 // static |
| 100 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, | 106 void ShownSectionsHandler::MigrateUserPrefs(PrefService* pref_service, |
| 101 int old_pref_version, | 107 int old_pref_version, |
| 102 int new_pref_version) { | 108 int new_pref_version) { |
| 103 bool changed = false; | 109 bool changed = false; |
| 104 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); | 110 int shown_sections = pref_service->GetInteger(prefs::kNTPShownSections); |
| 105 | 111 |
| 106 if (old_pref_version < 3) { | 112 if (old_pref_version < 3) { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 130 | 136 |
| 131 // Hide any open sections. | 137 // Hide any open sections. |
| 132 mode &= ~ALL_SECTIONS_MASK; | 138 mode &= ~ALL_SECTIONS_MASK; |
| 133 | 139 |
| 134 // Show the apps section. | 140 // Show the apps section. |
| 135 mode |= APPS; | 141 mode |= APPS; |
| 136 | 142 |
| 137 prefs->SetInteger(prefs::kNTPShownSections, mode); | 143 prefs->SetInteger(prefs::kNTPShownSections, mode); |
| 138 } | 144 } |
| 139 } | 145 } |
| OLD | NEW |