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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/extensions/bundle_installer.h" | 16 #include "chrome/browser/extensions/bundle_installer.h" |
17 #include "chrome/browser/extensions/extension_install_dialog.h" | 17 #include "chrome/browser/extensions/extension_install_dialog.h" |
18 #include "chrome/browser/extensions/extension_install_ui.h" | 18 #include "chrome/browser/extensions/extension_install_ui.h" |
19 #include "chrome/browser/prefs/pref_service.h" | 19 #include "chrome/browser/prefs/pref_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/signin/token_service.h" | 21 #include "chrome/browser/signin/token_service.h" |
22 #include "chrome/browser/signin/token_service_factory.h" | 22 #include "chrome/browser/signin/token_service_factory.h" |
23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
| 28 #include "chrome/common/extensions/extension_constants.h" |
28 #include "chrome/common/extensions/extension_icon_set.h" | 29 #include "chrome/common/extensions/extension_icon_set.h" |
29 #include "chrome/common/extensions/extension_manifest_constants.h" | 30 #include "chrome/common/extensions/extension_manifest_constants.h" |
30 #include "chrome/common/extensions/extension_resource.h" | 31 #include "chrome/common/extensions/extension_resource.h" |
31 #include "chrome/common/extensions/extension_switch_utils.h" | 32 #include "chrome/common/extensions/extension_switch_utils.h" |
32 #include "chrome/common/extensions/permissions/permission_set.h" | 33 #include "chrome/common/extensions/permissions/permission_set.h" |
33 #include "chrome/common/extensions/url_pattern.h" | 34 #include "chrome/common/extensions/url_pattern.h" |
34 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
35 #include "content/public/browser/page_navigator.h" | 36 #include "content/public/browser/page_navigator.h" |
36 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
37 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 429 |
429 void ExtensionInstallPrompt::LoadImageIfNeeded() { | 430 void ExtensionInstallPrompt::LoadImageIfNeeded() { |
430 // Bundle install prompts do not have an icon. | 431 // Bundle install prompts do not have an icon. |
431 if (!icon_.empty()) { | 432 if (!icon_.empty()) { |
432 FetchOAuthIssueAdviceIfNeeded(); | 433 FetchOAuthIssueAdviceIfNeeded(); |
433 return; | 434 return; |
434 } | 435 } |
435 | 436 |
436 // Load the image asynchronously. For the response, check OnImageLoaded. | 437 // Load the image asynchronously. For the response, check OnImageLoaded. |
437 ExtensionResource image = | 438 ExtensionResource image = |
438 extension_->GetIconResource(ExtensionIconSet::EXTENSION_ICON_LARGE, | 439 extension_->GetIconResource(extension_misc::EXTENSION_ICON_LARGE, |
439 ExtensionIconSet::MATCH_BIGGER); | 440 ExtensionIconSet::MATCH_BIGGER); |
440 tracker_.LoadImage(extension_, image, | 441 tracker_.LoadImage(extension_, image, |
441 gfx::Size(kIconSize, kIconSize), | 442 gfx::Size(kIconSize, kIconSize), |
442 ImageLoadingTracker::DONT_CACHE); | 443 ImageLoadingTracker::DONT_CACHE); |
443 } | 444 } |
444 | 445 |
445 void ExtensionInstallPrompt::FetchOAuthIssueAdviceIfNeeded() { | 446 void ExtensionInstallPrompt::FetchOAuthIssueAdviceIfNeeded() { |
446 const Extension::OAuth2Info& oauth2_info = extension_->oauth2_info(); | 447 const Extension::OAuth2Info& oauth2_info = extension_->oauth2_info(); |
447 if (ShouldAutomaticallyApproveScopes() || | 448 if (ShouldAutomaticallyApproveScopes() || |
448 prompt_.GetOAuthIssueCount() != 0U || | 449 prompt_.GetOAuthIssueCount() != 0U || |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 Browser* browser) { | 524 Browser* browser) { |
524 // |browser| can be NULL in unit tests. | 525 // |browser| can be NULL in unit tests. |
525 if (!browser) | 526 if (!browser) |
526 return new ExtensionInstallPrompt(NULL, NULL, NULL); | 527 return new ExtensionInstallPrompt(NULL, NULL, NULL); |
527 gfx::NativeWindow parent = | 528 gfx::NativeWindow parent = |
528 browser->window() ? browser->window()->GetNativeWindow() : NULL; | 529 browser->window() ? browser->window()->GetNativeWindow() : NULL; |
529 return new ExtensionInstallPrompt(parent, browser, browser->profile()); | 530 return new ExtensionInstallPrompt(parent, browser, browser->profile()); |
530 } | 531 } |
531 | 532 |
532 } // namespace chrome | 533 } // namespace chrome |
OLD | NEW |