| 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/extensions/extension_sync_data.h" | 5 #include "chrome/browser/extensions/extension_sync_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 all_urls_enabled_(BOOLEAN_UNSET), | 80 all_urls_enabled_(BOOLEAN_UNSET), |
| 81 installed_by_custodian_(false), | 81 installed_by_custodian_(false), |
| 82 launch_type_(LAUNCH_TYPE_INVALID) { | 82 launch_type_(LAUNCH_TYPE_INVALID) { |
| 83 } | 83 } |
| 84 | 84 |
| 85 ExtensionSyncData::ExtensionSyncData(const Extension& extension, | 85 ExtensionSyncData::ExtensionSyncData(const Extension& extension, |
| 86 bool enabled, | 86 bool enabled, |
| 87 int disable_reasons, | 87 int disable_reasons, |
| 88 bool incognito_enabled, | 88 bool incognito_enabled, |
| 89 bool remote_install, | 89 bool remote_install, |
| 90 OptionalBoolean all_urls_enabled) | 90 OptionalBoolean all_urls_enabled, |
| 91 bool installed_by_custodian) |
| 91 : ExtensionSyncData(extension, enabled, disable_reasons, incognito_enabled, | 92 : ExtensionSyncData(extension, enabled, disable_reasons, incognito_enabled, |
| 92 remote_install, all_urls_enabled, StringOrdinal(), | 93 remote_install, all_urls_enabled, |
| 94 installed_by_custodian, StringOrdinal(), |
| 93 StringOrdinal(), LAUNCH_TYPE_INVALID) { | 95 StringOrdinal(), LAUNCH_TYPE_INVALID) { |
| 94 } | 96 } |
| 95 | 97 |
| 96 ExtensionSyncData::ExtensionSyncData(const Extension& extension, | 98 ExtensionSyncData::ExtensionSyncData(const Extension& extension, |
| 97 bool enabled, | 99 bool enabled, |
| 98 int disable_reasons, | 100 int disable_reasons, |
| 99 bool incognito_enabled, | 101 bool incognito_enabled, |
| 100 bool remote_install, | 102 bool remote_install, |
| 101 OptionalBoolean all_urls_enabled, | 103 OptionalBoolean all_urls_enabled, |
| 104 bool installed_by_custodian, |
| 102 const StringOrdinal& app_launch_ordinal, | 105 const StringOrdinal& app_launch_ordinal, |
| 103 const StringOrdinal& page_ordinal, | 106 const StringOrdinal& page_ordinal, |
| 104 extensions::LaunchType launch_type) | 107 extensions::LaunchType launch_type) |
| 105 : is_app_(extension.is_app()), | 108 : is_app_(extension.is_app()), |
| 106 id_(extension.id()), | 109 id_(extension.id()), |
| 107 uninstalled_(false), | 110 uninstalled_(false), |
| 108 enabled_(enabled), | 111 enabled_(enabled), |
| 109 supports_disable_reasons_(true), | 112 supports_disable_reasons_(true), |
| 110 disable_reasons_(disable_reasons), | 113 disable_reasons_(disable_reasons), |
| 111 incognito_enabled_(incognito_enabled), | 114 incognito_enabled_(incognito_enabled), |
| 112 remote_install_(remote_install), | 115 remote_install_(remote_install), |
| 113 all_urls_enabled_(all_urls_enabled), | 116 all_urls_enabled_(all_urls_enabled), |
| 114 installed_by_custodian_(extension.was_installed_by_custodian()), | 117 installed_by_custodian_(installed_by_custodian), |
| 115 version_(extension.from_bookmark() ? base::Version("0") | 118 version_(extension.from_bookmark() ? base::Version("0") |
| 116 : *extension.version()), | 119 : *extension.version()), |
| 117 update_url_(ManifestURL::GetUpdateURL(&extension)), | 120 update_url_(ManifestURL::GetUpdateURL(&extension)), |
| 118 name_(extension.non_localized_name()), | 121 name_(extension.non_localized_name()), |
| 119 app_launch_ordinal_(app_launch_ordinal), | 122 app_launch_ordinal_(app_launch_ordinal), |
| 120 page_ordinal_(page_ordinal), | 123 page_ordinal_(page_ordinal), |
| 121 launch_type_(launch_type) { | 124 launch_type_(launch_type) { |
| 122 if (is_app_ && extension.from_bookmark()) { | 125 if (is_app_ && extension.from_bookmark()) { |
| 123 bookmark_app_description_ = extension.description(); | 126 bookmark_app_description_ = extension.description(); |
| 124 bookmark_app_url_ = AppLaunchInfo::GetLaunchWebURL(&extension).spec(); | 127 bookmark_app_url_ = AppLaunchInfo::GetLaunchWebURL(&extension).spec(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 320 |
| 318 if (entity_specifics.has_extension()) | 321 if (entity_specifics.has_extension()) |
| 319 return PopulateFromExtensionSpecifics(entity_specifics.extension()); | 322 return PopulateFromExtensionSpecifics(entity_specifics.extension()); |
| 320 | 323 |
| 321 LOG(ERROR) << "Attempt to sync bad EntitySpecifics: no extension data."; | 324 LOG(ERROR) << "Attempt to sync bad EntitySpecifics: no extension data."; |
| 322 RecordBadSyncData(NO_EXTENSION_SPECIFICS); | 325 RecordBadSyncData(NO_EXTENSION_SPECIFICS); |
| 323 return false; | 326 return false; |
| 324 } | 327 } |
| 325 | 328 |
| 326 } // namespace extensions | 329 } // namespace extensions |
| OLD | NEW |