| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/manifest_handlers/options_page_info.h" | 5 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "extensions/common/api/extensions_manifest_types.h" | 10 #include "extensions/common/api/extensions_manifest_types.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 scoped_ptr<OptionsPageInfo> OptionsPageInfo::Create( | 107 scoped_ptr<OptionsPageInfo> OptionsPageInfo::Create( |
| 108 Extension* extension, | 108 Extension* extension, |
| 109 const base::Value* options_ui_value, | 109 const base::Value* options_ui_value, |
| 110 const std::string& options_page_string, | 110 const std::string& options_page_string, |
| 111 std::vector<InstallWarning>* install_warnings, | 111 std::vector<InstallWarning>* install_warnings, |
| 112 base::string16* error) { | 112 base::string16* error) { |
| 113 GURL options_page; | 113 GURL options_page; |
| 114 bool chrome_style = false; | 114 bool chrome_style = false; |
| 115 bool open_in_tab = false; | 115 bool open_in_tab = !FeatureSwitch::embedded_extension_options()->IsEnabled(); |
| 116 | 116 |
| 117 // Parse the options_ui object. | 117 // Parse the options_ui object. |
| 118 if (options_ui_value) { | 118 if (options_ui_value && |
| 119 FeatureSwitch::embedded_extension_options()->IsEnabled()) { |
| 119 base::string16 options_ui_error; | 120 base::string16 options_ui_error; |
| 120 | 121 |
| 121 scoped_ptr<OptionsUI> options_ui = | 122 scoped_ptr<OptionsUI> options_ui = |
| 122 OptionsUI::FromValue(*options_ui_value, &options_ui_error); | 123 OptionsUI::FromValue(*options_ui_value, &options_ui_error); |
| 123 if (!options_ui_error.empty()) { | 124 if (!options_ui_error.empty()) { |
| 124 // OptionsUI::FromValue populates |error| both when there are | 125 // OptionsUI::FromValue populates |error| both when there are |
| 125 // errors (in which case |options_ui| will be NULL) and warnings | 126 // errors (in which case |options_ui| will be NULL) and warnings |
| 126 // (in which case |options_ui| will be valid). Either way, show it | 127 // (in which case |options_ui| will be valid). Either way, show it |
| 127 // as an install warning. | 128 // as an install warning. |
| 128 install_warnings->push_back( | 129 install_warnings->push_back( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 217 } |
| 217 return true; | 218 return true; |
| 218 } | 219 } |
| 219 | 220 |
| 220 const std::vector<std::string> OptionsPageManifestHandler::Keys() const { | 221 const std::vector<std::string> OptionsPageManifestHandler::Keys() const { |
| 221 static const char* keys[] = {keys::kOptionsPage, keys::kOptionsUI}; | 222 static const char* keys[] = {keys::kOptionsPage, keys::kOptionsUI}; |
| 222 return std::vector<std::string>(keys, keys + arraysize(keys)); | 223 return std::vector<std::string>(keys, keys + arraysize(keys)); |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace extensions | 226 } // namespace extensions |
| OLD | NEW |