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