| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/extensions/manifest_handlers/settings_overrides_handler.
h" | 5 #include "chrome/common/extensions/manifest_handlers/settings_overrides_handler.
h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (info->bookmarks_ui && !info->bookmarks_ui->remove_button && | 254 if (info->bookmarks_ui && !info->bookmarks_ui->remove_button && |
| 255 info->bookmarks_ui->hide_bookmark_button) { | 255 info->bookmarks_ui->hide_bookmark_button) { |
| 256 info->bookmarks_ui->remove_button.reset( | 256 info->bookmarks_ui->remove_button.reset( |
| 257 new bool(*info->bookmarks_ui->hide_bookmark_button)); | 257 new bool(*info->bookmarks_ui->hide_bookmark_button)); |
| 258 } | 258 } |
| 259 info->homepage = ParseHomepage(*settings, error); | 259 info->homepage = ParseHomepage(*settings, error); |
| 260 info->search_engine = ParseSearchEngine(settings.get(), error); | 260 info->search_engine = ParseSearchEngine(settings.get(), error); |
| 261 info->startup_pages = ParseStartupPage(*settings, error); | 261 info->startup_pages = ParseStartupPage(*settings, error); |
| 262 if (!info->bookmarks_ui && !info->homepage && | 262 if (!info->bookmarks_ui && !info->homepage && |
| 263 !info->search_engine && info->startup_pages.empty()) { | 263 !info->search_engine && info->startup_pages.empty()) { |
| 264 *error = | 264 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 265 base::ASCIIToUTF16(manifest_errors::kInvalidEmptySettingsOverrides); | 265 manifest_errors::kInvalidEmptyDictionary, |
| 266 manifest_keys::kSettingsOverride); |
| 266 return false; | 267 return false; |
| 267 } | 268 } |
| 268 info->manifest_permission.reset(new ManifestPermissionImpl( | 269 info->manifest_permission.reset(new ManifestPermissionImpl( |
| 269 SettingsOverrides::RemovesBookmarkButton(*info))); | 270 SettingsOverrides::RemovesBookmarkButton(*info))); |
| 270 | 271 |
| 271 APIPermissionSet* permission_set = | 272 APIPermissionSet* permission_set = |
| 272 PermissionsData::GetInitialAPIPermissions(extension); | 273 PermissionsData::GetInitialAPIPermissions(extension); |
| 273 DCHECK(permission_set); | 274 DCHECK(permission_set); |
| 274 if (info->search_engine) { | 275 if (info->search_engine) { |
| 275 permission_set->insert(new SettingsOverrideAPIPermission( | 276 permission_set->insert(new SettingsOverrideAPIPermission( |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 const SettingsOverrides* data = SettingsOverrides::Get(extension); | 329 const SettingsOverrides* data = SettingsOverrides::Get(extension); |
| 329 if (data) | 330 if (data) |
| 330 return data->manifest_permission->Clone(); | 331 return data->manifest_permission->Clone(); |
| 331 return NULL; | 332 return NULL; |
| 332 } | 333 } |
| 333 const std::vector<std::string> SettingsOverridesHandler::Keys() const { | 334 const std::vector<std::string> SettingsOverridesHandler::Keys() const { |
| 334 return SingleKey(manifest_keys::kSettingsOverride); | 335 return SingleKey(manifest_keys::kSettingsOverride); |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace extensions | 338 } // namespace extensions |
| OLD | NEW |