| 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/shown_sections_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { | 83 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { |
| 84 double mode_double; | 84 double mode_double; |
| 85 CHECK(args->GetDouble(0, &mode_double)); | 85 CHECK(args->GetDouble(0, &mode_double)); |
| 86 int mode = static_cast<int>(mode_double); | 86 int mode = static_cast<int>(mode_double); |
| 87 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); | 87 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); |
| 88 | 88 |
| 89 if (old_mode != mode) { | 89 if (old_mode != mode) { |
| 90 NotifySectionDisabled(mode, old_mode, web_ui_->GetProfile()); | 90 NotifySectionDisabled(mode, old_mode, Profile::FromWebUI(web_ui_)); |
| 91 pref_service_->SetInteger(prefs::kNTPShownSections, mode); | 91 pref_service_->SetInteger(prefs::kNTPShownSections, mode); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { | 96 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { |
| 97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 98 // Default to have expanded APPS and all other sections are minimized. | 98 // Default to have expanded APPS and all other sections are minimized. |
| 99 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, | 99 pref_service->RegisterIntegerPref(prefs::kNTPShownSections, |
| 100 APPS | MENU_THUMB | MENU_RECENT, | 100 APPS | MENU_THUMB | MENU_RECENT, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 // Hide any open sections. | 147 // Hide any open sections. |
| 148 mode &= ~ALL_SECTIONS_MASK; | 148 mode &= ~ALL_SECTIONS_MASK; |
| 149 | 149 |
| 150 // Show the apps section. | 150 // Show the apps section. |
| 151 mode |= APPS; | 151 mode |= APPS; |
| 152 | 152 |
| 153 prefs->SetInteger(prefs::kNTPShownSections, mode); | 153 prefs->SetInteger(prefs::kNTPShownSections, mode); |
| 154 } | 154 } |
| 155 } | 155 } |
| OLD | NEW |