| 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/ui/webui/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/extensions/extension_system.h" | 22 #include "chrome/browser/extensions/extension_system.h" |
| 23 #include "chrome/browser/extensions/extension_warning_set.h" | 23 #include "chrome/browser/extensions/extension_warning_set.h" |
| 24 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 24 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
| 25 #include "chrome/browser/extensions/unpacked_installer.h" | 25 #include "chrome/browser/extensions/unpacked_installer.h" |
| 26 #include "chrome/browser/extensions/updater/extension_updater.h" | 26 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 27 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/tab_contents/background_contents.h" | 30 #include "chrome/browser/tab_contents/background_contents.h" |
| 31 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 31 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 32 #include "chrome/browser/view_type_utils.h" |
| 32 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/chrome_view_type.h" | |
| 35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
| 36 #include "chrome/common/extensions/extension_icon_set.h" | 36 #include "chrome/common/extensions/extension_icon_set.h" |
| 37 #include "chrome/common/extensions/extension_set.h" | 37 #include "chrome/common/extensions/extension_set.h" |
| 38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
| 40 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 41 #include "content/public/browser/notification_source.h" | 41 #include "content/public/browser/notification_source.h" |
| 42 #include "content/public/browser/notification_types.h" | 42 #include "content/public/browser/notification_types.h" |
| 43 #include "content/public/browser/render_process_host.h" | 43 #include "content/public/browser/render_process_host.h" |
| 44 #include "content/public/browser/render_view_host.h" | 44 #include "content/public/browser/render_view_host.h" |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 794 |
| 795 return result; | 795 return result; |
| 796 } | 796 } |
| 797 | 797 |
| 798 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( | 798 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( |
| 799 const std::set<RenderViewHost*>& views, | 799 const std::set<RenderViewHost*>& views, |
| 800 std::vector<ExtensionPage> *result) { | 800 std::vector<ExtensionPage> *result) { |
| 801 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); | 801 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); |
| 802 iter != views.end(); ++iter) { | 802 iter != views.end(); ++iter) { |
| 803 RenderViewHost* host = *iter; | 803 RenderViewHost* host = *iter; |
| 804 int host_type = host->GetDelegate()->GetRenderViewType(); | 804 WebContents* web_contents = WebContents::FromRenderViewHost(host); |
| 805 chrome::ViewType host_type = chrome::GetViewType(web_contents); |
| 805 if (host == deleting_rvh_ || | 806 if (host == deleting_rvh_ || |
| 806 chrome::VIEW_TYPE_EXTENSION_POPUP == host_type || | 807 chrome::VIEW_TYPE_EXTENSION_POPUP == host_type || |
| 807 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) | 808 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) |
| 808 continue; | 809 continue; |
| 809 | 810 |
| 810 GURL url = host->GetDelegate()->GetURL(); | 811 GURL url = web_contents->GetURL(); |
| 811 content::RenderProcessHost* process = host->GetProcess(); | 812 content::RenderProcessHost* process = host->GetProcess(); |
| 812 result->push_back( | 813 result->push_back( |
| 813 ExtensionPage(url, process->GetID(), host->GetRoutingID(), | 814 ExtensionPage(url, process->GetID(), host->GetRoutingID(), |
| 814 process->GetBrowserContext()->IsOffTheRecord())); | 815 process->GetBrowserContext()->IsOffTheRecord())); |
| 815 } | 816 } |
| 816 } | 817 } |
| 817 | 818 |
| 818 ExtensionUninstallDialog* | 819 ExtensionUninstallDialog* |
| 819 ExtensionSettingsHandler::GetExtensionUninstallDialog() { | 820 ExtensionSettingsHandler::GetExtensionUninstallDialog() { |
| 820 #if !defined(OS_ANDROID) | 821 #if !defined(OS_ANDROID) |
| 821 if (!extension_uninstall_dialog_.get()) { | 822 if (!extension_uninstall_dialog_.get()) { |
| 822 extension_uninstall_dialog_.reset( | 823 extension_uninstall_dialog_.reset( |
| 823 ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this)); | 824 ExtensionUninstallDialog::Create(Profile::FromWebUI(web_ui()), this)); |
| 824 } | 825 } |
| 825 return extension_uninstall_dialog_.get(); | 826 return extension_uninstall_dialog_.get(); |
| 826 #else | 827 #else |
| 827 return NULL; | 828 return NULL; |
| 828 #endif // !defined(OS_ANDROID) | 829 #endif // !defined(OS_ANDROID) |
| 829 } | 830 } |
| 830 | 831 |
| 831 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 832 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
| 832 if (host) | 833 if (host) |
| 833 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 834 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
| 834 } | 835 } |
| OLD | NEW |