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/navigation_observer.h" | 5 #include "chrome/browser/extensions/navigation_observer.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_install_ui.h" | 7 #include "chrome/browser/extensions/extension_install_ui.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 registry->disabled_extensions().GetExtensionOrAppByURL( | 62 registry->disabled_extensions().GetExtensionOrAppByURL( |
63 nav_entry->GetURL()); | 63 nav_entry->GetURL()); |
64 if (!extension) | 64 if (!extension) |
65 return; | 65 return; |
66 | 66 |
67 // Try not to repeatedly prompt the user about the same extension. | 67 // Try not to repeatedly prompt the user about the same extension. |
68 if (prompted_extensions_.find(extension->id()) != prompted_extensions_.end()) | 68 if (prompted_extensions_.find(extension->id()) != prompted_extensions_.end()) |
69 return; | 69 return; |
70 prompted_extensions_.insert(extension->id()); | 70 prompted_extensions_.insert(extension->id()); |
71 | 71 |
72 ExtensionService* extension_service = | 72 ExtensionPrefs* extension_prefs = ExtensionPrefs::Get(profile_); |
73 extensions::ExtensionSystem::Get(profile_)->extension_service(); | |
74 ExtensionPrefs* extension_prefs = extension_service->extension_prefs(); | |
75 if (extension_prefs->DidExtensionEscalatePermissions(extension->id())) { | 73 if (extension_prefs->DidExtensionEscalatePermissions(extension->id())) { |
76 // Keep track of the extension id and nav controller we're prompting for. | 74 // Keep track of the extension id and nav controller we're prompting for. |
77 // These must be reset in InstallUIProceed and InstallUIAbort. | 75 // These must be reset in InstallUIProceed and InstallUIAbort. |
78 in_progress_prompt_extension_id_ = extension->id(); | 76 in_progress_prompt_extension_id_ = extension->id(); |
79 in_progress_prompt_navigation_controller_ = nav_controller; | 77 in_progress_prompt_navigation_controller_ = nav_controller; |
80 | 78 |
81 extension_install_prompt_.reset( | 79 extension_install_prompt_.reset( |
82 new ExtensionInstallPrompt(nav_controller->GetWebContents())); | 80 new ExtensionInstallPrompt(nav_controller->GetWebContents())); |
83 extension_install_prompt_->ConfirmReEnable(this, extension); | 81 extension_install_prompt_->ConfirmReEnable(this, extension); |
84 } | 82 } |
(...skipping 29 matching lines...) Expand all Loading... |
114 extension_install_prompt_.reset(); | 112 extension_install_prompt_.reset(); |
115 | 113 |
116 std::string histogram_name = user_initiated ? | 114 std::string histogram_name = user_initiated ? |
117 "Extensions.Permissions_ReEnableCancel" : | 115 "Extensions.Permissions_ReEnableCancel" : |
118 "Extensions.Permissions_ReEnableAbort"; | 116 "Extensions.Permissions_ReEnableAbort"; |
119 ExtensionService::RecordPermissionMessagesHistogram( | 117 ExtensionService::RecordPermissionMessagesHistogram( |
120 extension, histogram_name.c_str()); | 118 extension, histogram_name.c_str()); |
121 } | 119 } |
122 | 120 |
123 } // namespace extensions | 121 } // namespace extensions |
OLD | NEW |