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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 UIOverrides* assigned_ui_overrides = info.get(); |
185 extension->SetManifestData(manifest_keys::kUIOverride, info.release()); | 185 extension->SetManifestData(manifest_keys::kUIOverride, info.release()); |
186 assigned_ui_overrides->manifest_permission.reset(new ManifestPermissionImpl( | 186 assigned_ui_overrides->manifest_permission.reset(new ManifestPermissionImpl( |
187 UIOverrides::RemovesBookmarkButton(extension))); | 187 UIOverrides::RemovesBookmarkButton(extension) || |
188 UIOverrides::RemovesBookmarkShortcut(extension) || | |
189 UIOverrides::RemovesBookmarkOpenPagesShortcut(extension))); | |
not at google - send to devlin
2014/06/09 18:16:28
can this basically be info->bookmarks_ui.get() (i.
Mike Wittman
2014/06/09 19:57:34
Yes, I think so. Changed.
| |
188 return true; | 190 return true; |
189 } | 191 } |
190 | 192 |
191 bool UIOverridesHandler::Validate(const Extension* extension, | 193 bool UIOverridesHandler::Validate(const Extension* extension, |
192 std::string* error, | 194 std::string* error, |
193 std::vector<InstallWarning>* warnings) const { | 195 std::vector<InstallWarning>* warnings) const { |
194 const UIOverrides* ui_overrides = UIOverrides::Get(extension); | 196 const UIOverrides* ui_overrides = UIOverrides::Get(extension); |
195 | 197 |
196 if (ui_overrides && ui_overrides->bookmarks_ui) { | 198 if (ui_overrides && ui_overrides->bookmarks_ui) { |
197 if (!FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled()) { | 199 if (!FeatureSwitch::enable_override_bookmarks_ui()->IsEnabled()) { |
(...skipping 17 matching lines...) Expand all Loading... | |
215 const UIOverrides* data = UIOverrides::Get(extension); | 217 const UIOverrides* data = UIOverrides::Get(extension); |
216 if (data) | 218 if (data) |
217 return data->manifest_permission->Clone(); | 219 return data->manifest_permission->Clone(); |
218 return NULL; | 220 return NULL; |
219 } | 221 } |
220 const std::vector<std::string> UIOverridesHandler::Keys() const { | 222 const std::vector<std::string> UIOverridesHandler::Keys() const { |
221 return SingleKey(manifest_keys::kUIOverride); | 223 return SingleKey(manifest_keys::kUIOverride); |
222 } | 224 } |
223 | 225 |
224 } // namespace extensions | 226 } // namespace extensions |
OLD | NEW |