| 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 "base/memory/ptr_util.h" |
| 7 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 9 #include "content/public/browser/navigation_controller.h" | 10 #include "content/public/browser/navigation_controller.h" |
| 10 #include "content/public/browser/navigation_entry.h" | 11 #include "content/public/browser/navigation_entry.h" |
| 11 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 12 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 13 #include "extensions/browser/extension_prefs.h" | 14 #include "extensions/browser/extension_prefs.h" |
| 14 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/browser/extension_system.h" | 16 #include "extensions/browser/extension_system.h" |
| 16 | 17 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 80 |
| 80 extension_install_prompt_.reset( | 81 extension_install_prompt_.reset( |
| 81 new ExtensionInstallPrompt(nav_controller->GetWebContents())); | 82 new ExtensionInstallPrompt(nav_controller->GetWebContents())); |
| 82 ExtensionInstallPrompt::PromptType type = | 83 ExtensionInstallPrompt::PromptType type = |
| 83 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(profile_, | 84 ExtensionInstallPrompt::GetReEnablePromptTypeForExtension(profile_, |
| 84 extension); | 85 extension); |
| 85 extension_install_prompt_->ShowDialog( | 86 extension_install_prompt_->ShowDialog( |
| 86 base::Bind(&NavigationObserver::OnInstallPromptDone, | 87 base::Bind(&NavigationObserver::OnInstallPromptDone, |
| 87 weak_factory_.GetWeakPtr()), | 88 weak_factory_.GetWeakPtr()), |
| 88 extension, nullptr, | 89 extension, nullptr, |
| 89 make_scoped_ptr(new ExtensionInstallPrompt::Prompt(type)), | 90 base::WrapUnique(new ExtensionInstallPrompt::Prompt(type)), |
| 90 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 91 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| 91 } | 92 } |
| 92 } | 93 } |
| 93 | 94 |
| 94 void NavigationObserver::OnInstallPromptDone( | 95 void NavigationObserver::OnInstallPromptDone( |
| 95 ExtensionInstallPrompt::Result result) { | 96 ExtensionInstallPrompt::Result result) { |
| 96 ExtensionService* extension_service = | 97 ExtensionService* extension_service = |
| 97 extensions::ExtensionSystem::Get(profile_)->extension_service(); | 98 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 98 const Extension* extension = extension_service->GetExtensionById( | 99 const Extension* extension = extension_service->GetExtensionById( |
| 99 in_progress_prompt_extension_id_, true); | 100 in_progress_prompt_extension_id_, true); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 115 ExtensionService::RecordPermissionMessagesHistogram(extension, | 116 ExtensionService::RecordPermissionMessagesHistogram(extension, |
| 116 histogram_name.c_str()); | 117 histogram_name.c_str()); |
| 117 } | 118 } |
| 118 | 119 |
| 119 in_progress_prompt_extension_id_ = std::string(); | 120 in_progress_prompt_extension_id_ = std::string(); |
| 120 in_progress_prompt_navigation_controller_ = nullptr; | 121 in_progress_prompt_navigation_controller_ = nullptr; |
| 121 extension_install_prompt_.reset(); | 122 extension_install_prompt_.reset(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace extensions | 125 } // namespace extensions |
| OLD | NEW |