| 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/ui_overrides_handler.h" | 5 #include "chrome/common/extensions/manifest_handlers/ui_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/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return false; | 174 return false; |
| 175 | 175 |
| 176 scoped_ptr<UIOverrides> info(new UIOverrides); | 176 scoped_ptr<UIOverrides> info(new UIOverrides); |
| 177 info->bookmarks_ui.swap(overrides->bookmarks_ui); | 177 info->bookmarks_ui.swap(overrides->bookmarks_ui); |
| 178 if (!info->bookmarks_ui) { | 178 if (!info->bookmarks_ui) { |
| 179 *error = ErrorUtils::FormatErrorMessageUTF16( | 179 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 180 manifest_errors::kInvalidEmptyDictionary, | 180 manifest_errors::kInvalidEmptyDictionary, |
| 181 manifest_keys::kUIOverride); | 181 manifest_keys::kUIOverride); |
| 182 return false; | 182 return false; |
| 183 } | 183 } |
| 184 UIOverrides* assigned_ui_overrides = info.get(); | 184 info->manifest_permission.reset(new ManifestPermissionImpl( |
| 185 info->bookmarks_ui.get() != NULL)); |
| 185 extension->SetManifestData(manifest_keys::kUIOverride, info.release()); | 186 extension->SetManifestData(manifest_keys::kUIOverride, info.release()); |
| 186 assigned_ui_overrides->manifest_permission.reset(new ManifestPermissionImpl( | |
| 187 UIOverrides::RemovesBookmarkButton(extension))); | |
| 188 return true; | 187 return true; |
| 189 } | 188 } |
| 190 | 189 |
| 191 bool UIOverridesHandler::Validate(const Extension* extension, | 190 bool UIOverridesHandler::Validate(const Extension* extension, |
| 192 std::string* error, | 191 std::string* error, |
| 193 std::vector<InstallWarning>* warnings) const { | 192 std::vector<InstallWarning>* warnings) const { |
| 194 const UIOverrides* ui_overrides = UIOverrides::Get(extension); | 193 const UIOverrides* ui_overrides = UIOverrides::Get(extension); |
| 195 | 194 |
| 196 if (ui_overrides && ui_overrides->bookmarks_ui) { | 195 if (ui_overrides && ui_overrides->bookmarks_ui) { |
| 197 if (!FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled()) { | 196 if (!FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 215 const UIOverrides* data = UIOverrides::Get(extension); | 214 const UIOverrides* data = UIOverrides::Get(extension); |
| 216 if (data) | 215 if (data) |
| 217 return data->manifest_permission->Clone(); | 216 return data->manifest_permission->Clone(); |
| 218 return NULL; | 217 return NULL; |
| 219 } | 218 } |
| 220 const std::vector<std::string> UIOverridesHandler::Keys() const { | 219 const std::vector<std::string> UIOverridesHandler::Keys() const { |
| 221 return SingleKey(manifest_keys::kUIOverride); | 220 return SingleKey(manifest_keys::kUIOverride); |
| 222 } | 221 } |
| 223 | 222 |
| 224 } // namespace extensions | 223 } // namespace extensions |
| OLD | NEW |