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_install_prompt.h" | 5 #include "chrome/browser/extensions/extension_install_prompt.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 const IssueAdviceInfoEntry& ExtensionInstallPrompt::Prompt::GetOAuthIssue( | 225 const IssueAdviceInfoEntry& ExtensionInstallPrompt::Prompt::GetOAuthIssue( |
226 size_t index) const { | 226 size_t index) const { |
227 CHECK_LT(index, oauth_issue_advice_.size()); | 227 CHECK_LT(index, oauth_issue_advice_.size()); |
228 return oauth_issue_advice_[index]; | 228 return oauth_issue_advice_[index]; |
229 } | 229 } |
230 | 230 |
231 // static | 231 // static |
232 scoped_refptr<Extension> | 232 scoped_refptr<Extension> |
233 ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( | 233 ExtensionInstallPrompt::GetLocalizedExtensionForDisplay( |
234 const DictionaryValue* manifest, | 234 const DictionaryValue* manifest, |
| 235 int flags, |
235 const std::string& id, | 236 const std::string& id, |
236 const std::string& localized_name, | 237 const std::string& localized_name, |
237 const std::string& localized_description, | 238 const std::string& localized_description, |
238 std::string* error) { | 239 std::string* error) { |
239 scoped_ptr<DictionaryValue> localized_manifest; | 240 scoped_ptr<DictionaryValue> localized_manifest; |
240 if (!localized_name.empty() || !localized_description.empty()) { | 241 if (!localized_name.empty() || !localized_description.empty()) { |
241 localized_manifest.reset(manifest->DeepCopy()); | 242 localized_manifest.reset(manifest->DeepCopy()); |
242 if (!localized_name.empty()) { | 243 if (!localized_name.empty()) { |
243 localized_manifest->SetString(extension_manifest_keys::kName, | 244 localized_manifest->SetString(extension_manifest_keys::kName, |
244 localized_name); | 245 localized_name); |
245 } | 246 } |
246 if (!localized_description.empty()) { | 247 if (!localized_description.empty()) { |
247 localized_manifest->SetString(extension_manifest_keys::kDescription, | 248 localized_manifest->SetString(extension_manifest_keys::kDescription, |
248 localized_description); | 249 localized_description); |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
252 return Extension::Create( | 253 return Extension::Create( |
253 FilePath(), | 254 FilePath(), |
254 Extension::INTERNAL, | 255 Extension::INTERNAL, |
255 localized_manifest.get() ? *localized_manifest.get() : *manifest, | 256 localized_manifest.get() ? *localized_manifest.get() : *manifest, |
256 Extension::NO_FLAGS, | 257 flags, |
257 id, | 258 id, |
258 error); | 259 error); |
259 } | 260 } |
260 | 261 |
261 ExtensionInstallPrompt::ExtensionInstallPrompt( | 262 ExtensionInstallPrompt::ExtensionInstallPrompt( |
262 gfx::NativeWindow parent, | 263 gfx::NativeWindow parent, |
263 content::PageNavigator* navigator, | 264 content::PageNavigator* navigator, |
264 Profile* profile) | 265 Profile* profile) |
265 : record_oauth2_grant_(ShouldAutomaticallyApproveScopes()), | 266 : record_oauth2_grant_(ShouldAutomaticallyApproveScopes()), |
266 parent_(parent), | 267 parent_(parent), |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 Browser* browser) { | 504 Browser* browser) { |
504 // |browser| can be NULL in unit tests. | 505 // |browser| can be NULL in unit tests. |
505 if (!browser) | 506 if (!browser) |
506 return new ExtensionInstallPrompt(NULL, NULL, NULL); | 507 return new ExtensionInstallPrompt(NULL, NULL, NULL); |
507 gfx::NativeWindow parent = | 508 gfx::NativeWindow parent = |
508 browser->window() ? browser->window()->GetNativeWindow() : NULL; | 509 browser->window() ? browser->window()->GetNativeWindow() : NULL; |
509 return new ExtensionInstallPrompt(parent, browser, browser->profile()); | 510 return new ExtensionInstallPrompt(parent, browser, browser->profile()); |
510 } | 511 } |
511 | 512 |
512 } // namespace chrome | 513 } // namespace chrome |
OLD | NEW |