| 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 <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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) { | 87 void ShownSectionsHandler::HandleGetShownSections(const ListValue* args) { |
| 88 int sections = GetShownSections(pref_service_); | 88 int sections = GetShownSections(pref_service_); |
| 89 FundamentalValue sections_value(sections); | 89 FundamentalValue sections_value(sections); |
| 90 dom_ui_->CallJavascriptFunction(L"onShownSections", sections_value); | 90 dom_ui_->CallJavascriptFunction(L"onShownSections", sections_value); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { | 93 void ShownSectionsHandler::HandleSetShownSections(const ListValue* args) { |
| 94 int mode; | 94 double mode; |
| 95 CHECK(ExtractIntegerValue(args, &mode)); | 95 CHECK(args->GetReal(0, &mode)); |
| 96 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); | 96 int old_mode = pref_service_->GetInteger(prefs::kNTPShownSections); |
| 97 | 97 |
| 98 if (old_mode != mode) { | 98 if (old_mode != mode) { |
| 99 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); | 99 NotifySectionDisabled(mode, old_mode, dom_ui_->GetProfile()); |
| 100 pref_service_->SetInteger(prefs::kNTPShownSections, mode); | 100 pref_service_->SetInteger(prefs::kNTPShownSections, mode); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 // static | 104 // static |
| 105 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { | 105 void ShownSectionsHandler::RegisterUserPrefs(PrefService* pref_service) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 // Hide any open sections. | 153 // Hide any open sections. |
| 154 mode &= ~ALL_SECTIONS_MASK; | 154 mode &= ~ALL_SECTIONS_MASK; |
| 155 | 155 |
| 156 // Show the apps section. | 156 // Show the apps section. |
| 157 mode |= APPS; | 157 mode |= APPS; |
| 158 | 158 |
| 159 prefs->SetInteger(prefs::kNTPShownSections, mode); | 159 prefs->SetInteger(prefs::kNTPShownSections, mode); |
| 160 } | 160 } |
| 161 } | 161 } |
| OLD | NEW |