| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/flags_ui.h" | 5 #include "chrome/browser/ui/webui/flags_ui.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Callback for the "enableExperimentalFeature" message. | 135 // Callback for the "enableExperimentalFeature" message. |
| 136 void HandleEnableExperimentalFeatureMessage(const base::ListValue* args); | 136 void HandleEnableExperimentalFeatureMessage(const base::ListValue* args); |
| 137 | 137 |
| 138 // Callback for the "restartBrowser" message. Restores all tabs on restart. | 138 // Callback for the "restartBrowser" message. Restores all tabs on restart. |
| 139 void HandleRestartBrowser(const base::ListValue* args); | 139 void HandleRestartBrowser(const base::ListValue* args); |
| 140 | 140 |
| 141 // Callback for the "resetAllFlags" message. | 141 // Callback for the "resetAllFlags" message. |
| 142 void HandleResetAllFlags(const base::ListValue* args); | 142 void HandleResetAllFlags(const base::ListValue* args); |
| 143 | 143 |
| 144 private: | 144 private: |
| 145 scoped_ptr<flags_ui::FlagsStorage> flags_storage_; | 145 std::unique_ptr<flags_ui::FlagsStorage> flags_storage_; |
| 146 flags_ui::FlagAccess access_; | 146 flags_ui::FlagAccess access_; |
| 147 bool experimental_features_requested_; | 147 bool experimental_features_requested_; |
| 148 | 148 |
| 149 DISALLOW_COPY_AND_ASSIGN(FlagsDOMHandler); | 149 DISALLOW_COPY_AND_ASSIGN(FlagsDOMHandler); |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 void FlagsDOMHandler::RegisterMessages() { | 152 void FlagsDOMHandler::RegisterMessages() { |
| 153 web_ui()->RegisterMessageCallback( | 153 web_ui()->RegisterMessageCallback( |
| 154 flags_ui::kRequestExperimentalFeatures, | 154 flags_ui::kRequestExperimentalFeatures, |
| 155 base::Bind(&FlagsDOMHandler::HandleRequestExperimentalFeatures, | 155 base::Bind(&FlagsDOMHandler::HandleRequestExperimentalFeatures, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 180 void FlagsDOMHandler::HandleRequestExperimentalFeatures( | 180 void FlagsDOMHandler::HandleRequestExperimentalFeatures( |
| 181 const base::ListValue* args) { | 181 const base::ListValue* args) { |
| 182 experimental_features_requested_ = true; | 182 experimental_features_requested_ = true; |
| 183 // Bail out if the handler hasn't been initialized yet. The request will be | 183 // Bail out if the handler hasn't been initialized yet. The request will be |
| 184 // handled after the initialization. | 184 // handled after the initialization. |
| 185 if (!flags_storage_) | 185 if (!flags_storage_) |
| 186 return; | 186 return; |
| 187 | 187 |
| 188 base::DictionaryValue results; | 188 base::DictionaryValue results; |
| 189 | 189 |
| 190 scoped_ptr<base::ListValue> supported_features(new base::ListValue); | 190 std::unique_ptr<base::ListValue> supported_features(new base::ListValue); |
| 191 scoped_ptr<base::ListValue> unsupported_features(new base::ListValue); | 191 std::unique_ptr<base::ListValue> unsupported_features(new base::ListValue); |
| 192 about_flags::GetFlagFeatureEntries(flags_storage_.get(), | 192 about_flags::GetFlagFeatureEntries(flags_storage_.get(), |
| 193 access_, | 193 access_, |
| 194 supported_features.get(), | 194 supported_features.get(), |
| 195 unsupported_features.get()); | 195 unsupported_features.get()); |
| 196 results.Set(flags_ui::kSupportedFeatures, supported_features.release()); | 196 results.Set(flags_ui::kSupportedFeatures, supported_features.release()); |
| 197 results.Set(flags_ui::kUnsupportedFeatures, unsupported_features.release()); | 197 results.Set(flags_ui::kUnsupportedFeatures, unsupported_features.release()); |
| 198 results.SetBoolean(flags_ui::kNeedsRestart, | 198 results.SetBoolean(flags_ui::kNeedsRestart, |
| 199 about_flags::IsRestartNeededToCommitChanges()); | 199 about_flags::IsRestartNeededToCommitChanges()); |
| 200 results.SetBoolean(flags_ui::kShowOwnerWarning, | 200 results.SetBoolean(flags_ui::kShowOwnerWarning, |
| 201 access_ == flags_ui::kGeneralAccessFlagsOnly); | 201 access_ == flags_ui::kGeneralAccessFlagsOnly); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 FlagsUI::~FlagsUI() { | 335 FlagsUI::~FlagsUI() { |
| 336 } | 336 } |
| 337 | 337 |
| 338 // static | 338 // static |
| 339 base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes( | 339 base::RefCountedMemory* FlagsUI::GetFaviconResourceBytes( |
| 340 ui::ScaleFactor scale_factor) { | 340 ui::ScaleFactor scale_factor) { |
| 341 return ResourceBundle::GetSharedInstance(). | 341 return ResourceBundle::GetSharedInstance(). |
| 342 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); | 342 LoadDataResourceBytesForScale(IDR_FLAGS_FAVICON, scale_factor); |
| 343 } | 343 } |
| OLD | NEW |