| 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 "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" | 
| 8 #include "apps/saved_files_service.h" | 8 #include "apps/saved_files_service.h" | 
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" | 
| 10 #include "base/base64.h" | 10 #include "base/base64.h" | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 43 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" | 
| 44 #include "chrome/browser/ui/apps/app_info_dialog.h" | 44 #include "chrome/browser/ui/apps/app_info_dialog.h" | 
| 45 #include "chrome/browser/ui/browser.h" | 45 #include "chrome/browser/ui/browser.h" | 
| 46 #include "chrome/browser/ui/browser_finder.h" | 46 #include "chrome/browser/ui/browser_finder.h" | 
| 47 #include "chrome/browser/ui/browser_window.h" | 47 #include "chrome/browser/ui/browser_window.h" | 
| 48 #include "chrome/browser/ui/extensions/app_launch_params.h" | 48 #include "chrome/browser/ui/extensions/app_launch_params.h" | 
| 49 #include "chrome/browser/ui/extensions/application_launch.h" | 49 #include "chrome/browser/ui/extensions/application_launch.h" | 
| 50 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" | 50 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" | 
| 51 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 51 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 
| 52 #include "chrome/common/chrome_version_info.h" | 52 #include "chrome/common/chrome_version_info.h" | 
|  | 53 #include "chrome/common/extensions/api/developer_private.h" | 
| 53 #include "chrome/common/extensions/features/feature_channel.h" | 54 #include "chrome/common/extensions/features/feature_channel.h" | 
| 54 #include "chrome/common/pref_names.h" | 55 #include "chrome/common/pref_names.h" | 
| 55 #include "chrome/common/url_constants.h" | 56 #include "chrome/common/url_constants.h" | 
| 56 #include "chrome/grit/chromium_strings.h" | 57 #include "chrome/grit/chromium_strings.h" | 
| 57 #include "chrome/grit/generated_resources.h" | 58 #include "chrome/grit/generated_resources.h" | 
| 58 #include "components/google/core/browser/google_util.h" | 59 #include "components/google/core/browser/google_util.h" | 
| 59 #include "components/pref_registry/pref_registry_syncable.h" | 60 #include "components/pref_registry/pref_registry_syncable.h" | 
| 60 #include "content/public/browser/notification_service.h" | 61 #include "content/public/browser/notification_service.h" | 
| 61 #include "content/public/browser/notification_source.h" | 62 #include "content/public/browser/notification_source.h" | 
| 62 #include "content/public/browser/notification_types.h" | 63 #include "content/public/browser/notification_types.h" | 
| 63 #include "content/public/browser/render_process_host.h" | 64 #include "content/public/browser/render_process_host.h" | 
| 64 #include "content/public/browser/render_view_host.h" | 65 #include "content/public/browser/render_view_host.h" | 
| 65 #include "content/public/browser/site_instance.h" | 66 #include "content/public/browser/site_instance.h" | 
| 66 #include "content/public/browser/web_contents.h" | 67 #include "content/public/browser/web_contents.h" | 
| 67 #include "content/public/browser/web_ui.h" | 68 #include "content/public/browser/web_ui.h" | 
| 68 #include "content/public/browser/web_ui_data_source.h" | 69 #include "content/public/browser/web_ui_data_source.h" | 
| 69 #include "extensions/browser/api/device_permissions_manager.h" | 70 #include "extensions/browser/api/device_permissions_manager.h" | 
| 70 #include "extensions/browser/app_window/app_window.h" |  | 
| 71 #include "extensions/browser/app_window/app_window_registry.h" |  | 
| 72 #include "extensions/browser/blacklist_state.h" | 71 #include "extensions/browser/blacklist_state.h" | 
| 73 #include "extensions/browser/extension_error.h" | 72 #include "extensions/browser/extension_error.h" | 
| 74 #include "extensions/browser/extension_host.h" | 73 #include "extensions/browser/extension_host.h" | 
| 75 #include "extensions/browser/extension_registry.h" | 74 #include "extensions/browser/extension_registry.h" | 
| 76 #include "extensions/browser/extension_system.h" | 75 #include "extensions/browser/extension_system.h" | 
| 77 #include "extensions/browser/lazy_background_task_queue.h" | 76 #include "extensions/browser/lazy_background_task_queue.h" | 
| 78 #include "extensions/browser/management_policy.h" | 77 #include "extensions/browser/management_policy.h" | 
| 79 #include "extensions/browser/pref_names.h" | 78 #include "extensions/browser/pref_names.h" | 
| 80 #include "extensions/browser/view_type_utils.h" |  | 
| 81 #include "extensions/browser/warning_set.h" | 79 #include "extensions/browser/warning_set.h" | 
| 82 #include "extensions/common/constants.h" | 80 #include "extensions/common/constants.h" | 
| 83 #include "extensions/common/extension.h" | 81 #include "extensions/common/extension.h" | 
| 84 #include "extensions/common/extension_icon_set.h" | 82 #include "extensions/common/extension_icon_set.h" | 
| 85 #include "extensions/common/extension_set.h" | 83 #include "extensions/common/extension_set.h" | 
| 86 #include "extensions/common/extension_urls.h" | 84 #include "extensions/common/extension_urls.h" | 
| 87 #include "extensions/common/feature_switch.h" | 85 #include "extensions/common/feature_switch.h" | 
| 88 #include "extensions/common/manifest.h" | 86 #include "extensions/common/manifest.h" | 
| 89 #include "extensions/common/manifest_handlers/background_info.h" | 87 #include "extensions/common/manifest_handlers/background_info.h" | 
| 90 #include "extensions/common/manifest_handlers/incognito_info.h" | 88 #include "extensions/common/manifest_handlers/incognito_info.h" | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 103 | 101 | 
| 104 namespace { | 102 namespace { | 
| 105 | 103 | 
| 106 const char kAppsDeveloperToolsExtensionId[] = | 104 const char kAppsDeveloperToolsExtensionId[] = | 
| 107     "ohmmkhmmmpcnpikjeljgnaoabkaalbgc"; | 105     "ohmmkhmmmpcnpikjeljgnaoabkaalbgc"; | 
| 108 | 106 | 
| 109 }  // namespace | 107 }  // namespace | 
| 110 | 108 | 
| 111 namespace extensions { | 109 namespace extensions { | 
| 112 | 110 | 
| 113 ExtensionPage::ExtensionPage(const GURL& url, |  | 
| 114                              int render_process_id, |  | 
| 115                              int render_view_id, |  | 
| 116                              bool incognito, |  | 
| 117                              bool generated_background_page) |  | 
| 118     : url(url), |  | 
| 119       render_process_id(render_process_id), |  | 
| 120       render_view_id(render_view_id), |  | 
| 121       incognito(incognito), |  | 
| 122       generated_background_page(generated_background_page) { |  | 
| 123 } |  | 
| 124 |  | 
| 125 // The install prompt is not necessarily modal (e.g. Mac, Linux Unity). This | 111 // The install prompt is not necessarily modal (e.g. Mac, Linux Unity). This | 
| 126 // means that the user can navigate while the dialog is up, causing the dialog | 112 // means that the user can navigate while the dialog is up, causing the dialog | 
| 127 // handler to outlive the ExtensionSettingsHandler. That's a problem because the | 113 // handler to outlive the ExtensionSettingsHandler. That's a problem because the | 
| 128 // dialog framework will try to contact us back once the dialog is closed, which | 114 // dialog framework will try to contact us back once the dialog is closed, which | 
| 129 // causes a crash. This class is designed to broker the message between the two | 115 // causes a crash. This class is designed to broker the message between the two | 
| 130 // objects, while managing its own lifetime so that it can outlive the | 116 // objects, while managing its own lifetime so that it can outlive the | 
| 131 // ExtensionSettingsHandler and (when doing so) gracefully ignore the message | 117 // ExtensionSettingsHandler and (when doing so) gracefully ignore the message | 
| 132 // from the dialog. | 118 // from the dialog. | 
| 133 class BrokerDelegate : public ExtensionInstallPrompt::Delegate { | 119 class BrokerDelegate : public ExtensionInstallPrompt::Delegate { | 
| 134  public: | 120  public: | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 211       false, | 197       false, | 
| 212       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 198       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 
| 213   registry->RegisterBooleanPref( | 199   registry->RegisterBooleanPref( | 
| 214       prefs::kExtensionsUIDismissedADTPromo, | 200       prefs::kExtensionsUIDismissedADTPromo, | 
| 215       false, | 201       false, | 
| 216       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 202       user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 
| 217 } | 203 } | 
| 218 | 204 | 
| 219 base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( | 205 base::DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( | 
| 220     const Extension* extension, | 206     const Extension* extension, | 
| 221     const std::vector<ExtensionPage>& pages, | 207     const InspectableViewsFinder::ViewList& views, | 
| 222     const WarningService* warning_service) { | 208     const WarningService* warning_service) { | 
| 223   // The items which are to be written into app_dict are also described in | 209   // The items which are to be written into app_dict are also described in | 
| 224   // chrome/browser/resources/extensions/extension_list.js in @typedef for | 210   // chrome/browser/resources/extensions/extension_list.js in @typedef for | 
| 225   // ExtensionData. Please update it whenever you add or remove any keys here. | 211   // ExtensionData. Please update it whenever you add or remove any keys here. | 
| 226   base::DictionaryValue* extension_data = new base::DictionaryValue(); | 212   base::DictionaryValue* extension_data = new base::DictionaryValue(); | 
| 227   bool enabled = extension_service_->IsExtensionEnabled(extension->id()); | 213   bool enabled = extension_service_->IsExtensionEnabled(extension->id()); | 
| 228   GetExtensionBasicInfo(extension, enabled, extension_data); | 214   GetExtensionBasicInfo(extension, enabled, extension_data); | 
| 229 | 215 | 
| 230   ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); | 216   ExtensionPrefs* prefs = ExtensionPrefs::Get(extension_service_->profile()); | 
| 231   int disable_reasons = prefs->GetDisableReasons(extension->id()); | 217   int disable_reasons = prefs->GetDisableReasons(extension->id()); | 
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 391 | 377 | 
| 392   // Don't show the "show button" for the browser action if the toolbar | 378   // Don't show the "show button" for the browser action if the toolbar | 
| 393   // redesign is enabled, because "hidden" buttons are now just hidden in the | 379   // redesign is enabled, because "hidden" buttons are now just hidden in the | 
| 394   // wrench menu. | 380   // wrench menu. | 
| 395   if (!ExtensionActionAPI::GetBrowserActionVisibility(prefs, extension->id()) && | 381   if (!ExtensionActionAPI::GetBrowserActionVisibility(prefs, extension->id()) && | 
| 396       !FeatureSwitch::extension_action_redesign()->IsEnabled()) { | 382       !FeatureSwitch::extension_action_redesign()->IsEnabled()) { | 
| 397     extension_data->SetBoolean("enable_show_button", true); | 383     extension_data->SetBoolean("enable_show_button", true); | 
| 398   } | 384   } | 
| 399 | 385 | 
| 400   // Add views | 386   // Add views | 
| 401   base::ListValue* views = new base::ListValue; | 387   base::ListValue* views_value = new base::ListValue; | 
| 402   for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); | 388   for (const InspectableViewsFinder::View& view : views) | 
| 403        iter != pages.end(); ++iter) { | 389     views_value->Append(view->ToValue().release()); | 
| 404     base::DictionaryValue* view_value = new base::DictionaryValue; | 390   extension_data->Set("views", views_value); | 
| 405     if (iter->url.scheme() == kExtensionScheme) { |  | 
| 406       // No leading slash. |  | 
| 407       view_value->SetString("path", iter->url.path().substr(1)); |  | 
| 408     } else { |  | 
| 409       // For live pages, use the full URL. |  | 
| 410       view_value->SetString("path", iter->url.spec()); |  | 
| 411     } |  | 
| 412     view_value->SetInteger("renderViewId", iter->render_view_id); |  | 
| 413     view_value->SetInteger("renderProcessId", iter->render_process_id); |  | 
| 414     view_value->SetBoolean("incognito", iter->incognito); |  | 
| 415     view_value->SetBoolean("generatedBackgroundPage", |  | 
| 416                            iter->generated_background_page); |  | 
| 417     views->Append(view_value); |  | 
| 418   } |  | 
| 419   extension_data->Set("views", views); |  | 
| 420   ExtensionActionManager* extension_action_manager = | 391   ExtensionActionManager* extension_action_manager = | 
| 421       ExtensionActionManager::Get(extension_service_->profile()); | 392       ExtensionActionManager::Get(extension_service_->profile()); | 
| 422   extension_data->SetBoolean( | 393   extension_data->SetBoolean( | 
| 423       "hasPopupAction", | 394       "hasPopupAction", | 
| 424       extension_action_manager->GetBrowserAction(*extension) || | 395       extension_action_manager->GetBrowserAction(*extension) || | 
| 425       extension_action_manager->GetPageAction(*extension)); | 396       extension_action_manager->GetPageAction(*extension)); | 
| 426 | 397 | 
| 427   // Add warnings. | 398   // Add warnings. | 
| 428   if (warning_service) { | 399   if (warning_service) { | 
| 429     std::vector<std::string> warnings = | 400     std::vector<std::string> warnings = | 
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 897 | 868 | 
| 898   Profile* profile = Profile::FromWebUI(web_ui()); | 869   Profile* profile = Profile::FromWebUI(web_ui()); | 
| 899 | 870 | 
| 900   // Add the extensions to the results structure. | 871   // Add the extensions to the results structure. | 
| 901   base::ListValue* extensions_list = new base::ListValue(); | 872   base::ListValue* extensions_list = new base::ListValue(); | 
| 902 | 873 | 
| 903   WarningService* warnings = WarningService::Get(profile); | 874   WarningService* warnings = WarningService::Get(profile); | 
| 904 | 875 | 
| 905   ExtensionRegistry* registry = ExtensionRegistry::Get(profile); | 876   ExtensionRegistry* registry = ExtensionRegistry::Get(profile); | 
| 906   const ExtensionSet& enabled_set = registry->enabled_extensions(); | 877   const ExtensionSet& enabled_set = registry->enabled_extensions(); | 
|  | 878   InspectableViewsFinder views_finder(profile, deleting_rvh_); | 
| 907   for (ExtensionSet::const_iterator extension = enabled_set.begin(); | 879   for (ExtensionSet::const_iterator extension = enabled_set.begin(); | 
| 908        extension != enabled_set.end(); ++extension) { | 880        extension != enabled_set.end(); ++extension) { | 
| 909     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 881     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 
| 910       extensions_list->Append(CreateExtensionDetailValue( | 882       extensions_list->Append(CreateExtensionDetailValue( | 
| 911           extension->get(), | 883           extension->get(), | 
| 912           GetInspectablePagesForExtension(extension->get(), true), | 884           views_finder.GetViewsForExtension(**extension, true), | 
| 913           warnings)); | 885           warnings)); | 
| 914     } | 886     } | 
| 915   } | 887   } | 
| 916   const ExtensionSet& disabled_set = registry->disabled_extensions(); | 888   const ExtensionSet& disabled_set = registry->disabled_extensions(); | 
| 917   for (ExtensionSet::const_iterator extension = disabled_set.begin(); | 889   for (ExtensionSet::const_iterator extension = disabled_set.begin(); | 
| 918        extension != disabled_set.end(); ++extension) { | 890        extension != disabled_set.end(); ++extension) { | 
| 919     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 891     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 
| 920       extensions_list->Append(CreateExtensionDetailValue( | 892       extensions_list->Append(CreateExtensionDetailValue( | 
| 921           extension->get(), | 893           extension->get(), | 
| 922           GetInspectablePagesForExtension(extension->get(), false), | 894           views_finder.GetViewsForExtension(**extension, false), | 
| 923           warnings)); | 895           warnings)); | 
| 924     } | 896     } | 
| 925   } | 897   } | 
| 926   const ExtensionSet& terminated_set = registry->terminated_extensions(); | 898   const ExtensionSet& terminated_set = registry->terminated_extensions(); | 
| 927   std::vector<ExtensionPage> empty_pages; |  | 
| 928   for (ExtensionSet::const_iterator extension = terminated_set.begin(); | 899   for (ExtensionSet::const_iterator extension = terminated_set.begin(); | 
| 929        extension != terminated_set.end(); ++extension) { | 900        extension != terminated_set.end(); ++extension) { | 
| 930     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 901     if (ui_util::ShouldDisplayInExtensionSettings(extension->get(), profile)) { | 
| 931       extensions_list->Append(CreateExtensionDetailValue( | 902       extensions_list->Append(CreateExtensionDetailValue( | 
| 932           extension->get(), | 903           extension->get(), | 
| 933           empty_pages,  // Terminated process has no active pages. | 904           InspectableViewsFinder::ViewList(),  // No views for terminated. | 
| 934           warnings)); | 905           warnings)); | 
| 935     } | 906     } | 
| 936   } | 907   } | 
| 937   results.Set("extensions", extensions_list); | 908   results.Set("extensions", extensions_list); | 
| 938 | 909 | 
| 939   bool is_supervised = profile->IsSupervised(); | 910   bool is_supervised = profile->IsSupervised(); | 
| 940   bool incognito_available = | 911   bool incognito_available = | 
| 941       IncognitoModePrefs::GetAvailability(profile->GetPrefs()) != | 912       IncognitoModePrefs::GetAvailability(profile->GetPrefs()) != | 
| 942           IncognitoModePrefs::DISABLED; | 913           IncognitoModePrefs::DISABLED; | 
| 943   bool developer_mode = | 914   bool developer_mode = | 
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1204   content::WebContentsObserver::Observe(web_ui()->GetWebContents()); | 1175   content::WebContentsObserver::Observe(web_ui()->GetWebContents()); | 
| 1205 | 1176 | 
| 1206   warning_service_observer_.Add(WarningService::Get(profile)); | 1177   warning_service_observer_.Add(WarningService::Get(profile)); | 
| 1207 | 1178 | 
| 1208   error_console_observer_.Add(ErrorConsole::Get(profile)); | 1179   error_console_observer_.Add(ErrorConsole::Get(profile)); | 
| 1209 | 1180 | 
| 1210   extension_management_observer_.Add( | 1181   extension_management_observer_.Add( | 
| 1211       ExtensionManagementFactory::GetForBrowserContext(profile)); | 1182       ExtensionManagementFactory::GetForBrowserContext(profile)); | 
| 1212 } | 1183 } | 
| 1213 | 1184 | 
| 1214 std::vector<ExtensionPage> |  | 
| 1215 ExtensionSettingsHandler::GetInspectablePagesForExtension( |  | 
| 1216     const Extension* extension, bool extension_is_enabled) { |  | 
| 1217   std::vector<ExtensionPage> result; |  | 
| 1218 |  | 
| 1219   // Get the extension process's active views. |  | 
| 1220   extensions::ProcessManager* process_manager = |  | 
| 1221       ProcessManager::Get(extension_service_->profile()); |  | 
| 1222   GetInspectablePagesForExtensionProcess( |  | 
| 1223       extension, |  | 
| 1224       process_manager->GetRenderViewHostsForExtension(extension->id()), |  | 
| 1225       &result); |  | 
| 1226 |  | 
| 1227   // Get app window views |  | 
| 1228   GetAppWindowPagesForExtensionProfile( |  | 
| 1229       extension, extension_service_->profile(), &result); |  | 
| 1230 |  | 
| 1231   // Include a link to start the lazy background page, if applicable. |  | 
| 1232   if (BackgroundInfo::HasLazyBackgroundPage(extension) && |  | 
| 1233       extension_is_enabled && |  | 
| 1234       !process_manager->GetBackgroundHostForExtension(extension->id())) { |  | 
| 1235     result.push_back(ExtensionPage( |  | 
| 1236         BackgroundInfo::GetBackgroundURL(extension), |  | 
| 1237         -1, |  | 
| 1238         -1, |  | 
| 1239         false, |  | 
| 1240         BackgroundInfo::HasGeneratedBackgroundPage(extension))); |  | 
| 1241   } |  | 
| 1242 |  | 
| 1243   // Repeat for the incognito process, if applicable. Don't try to get |  | 
| 1244   // app windows for incognito processes. |  | 
| 1245   if (extension_service_->profile()->HasOffTheRecordProfile() && |  | 
| 1246       IncognitoInfo::IsSplitMode(extension) && |  | 
| 1247       util::IsIncognitoEnabled(extension->id(), |  | 
| 1248                                extension_service_->profile())) { |  | 
| 1249     extensions::ProcessManager* process_manager = ProcessManager::Get( |  | 
| 1250         extension_service_->profile()->GetOffTheRecordProfile()); |  | 
| 1251     GetInspectablePagesForExtensionProcess( |  | 
| 1252         extension, |  | 
| 1253         process_manager->GetRenderViewHostsForExtension(extension->id()), |  | 
| 1254         &result); |  | 
| 1255 |  | 
| 1256     if (BackgroundInfo::HasLazyBackgroundPage(extension) && |  | 
| 1257         extension_is_enabled && |  | 
| 1258         !process_manager->GetBackgroundHostForExtension(extension->id())) { |  | 
| 1259       result.push_back(ExtensionPage( |  | 
| 1260           BackgroundInfo::GetBackgroundURL(extension), |  | 
| 1261           -1, |  | 
| 1262           -1, |  | 
| 1263           true, |  | 
| 1264           BackgroundInfo::HasGeneratedBackgroundPage(extension))); |  | 
| 1265     } |  | 
| 1266   } |  | 
| 1267 |  | 
| 1268   return result; |  | 
| 1269 } |  | 
| 1270 |  | 
| 1271 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( |  | 
| 1272     const Extension* extension, |  | 
| 1273     const std::set<RenderViewHost*>& views, |  | 
| 1274     std::vector<ExtensionPage>* result) { |  | 
| 1275   bool has_generated_background_page = |  | 
| 1276       BackgroundInfo::HasGeneratedBackgroundPage(extension); |  | 
| 1277   for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); |  | 
| 1278        iter != views.end(); ++iter) { |  | 
| 1279     RenderViewHost* host = *iter; |  | 
| 1280     WebContents* web_contents = WebContents::FromRenderViewHost(host); |  | 
| 1281     ViewType host_type = GetViewType(web_contents); |  | 
| 1282     if (host == deleting_rvh_ || |  | 
| 1283         VIEW_TYPE_EXTENSION_POPUP == host_type || |  | 
| 1284         VIEW_TYPE_EXTENSION_DIALOG == host_type) |  | 
| 1285       continue; |  | 
| 1286 |  | 
| 1287     GURL url = web_contents->GetURL(); |  | 
| 1288     content::RenderProcessHost* process = host->GetProcess(); |  | 
| 1289     bool is_background_page = |  | 
| 1290         (url == BackgroundInfo::GetBackgroundURL(extension)); |  | 
| 1291     result->push_back( |  | 
| 1292         ExtensionPage(url, |  | 
| 1293                       process->GetID(), |  | 
| 1294                       host->GetRoutingID(), |  | 
| 1295                       process->GetBrowserContext()->IsOffTheRecord(), |  | 
| 1296                       is_background_page && has_generated_background_page)); |  | 
| 1297   } |  | 
| 1298 } |  | 
| 1299 |  | 
| 1300 void ExtensionSettingsHandler::GetAppWindowPagesForExtensionProfile( |  | 
| 1301     const Extension* extension, |  | 
| 1302     Profile* profile, |  | 
| 1303     std::vector<ExtensionPage>* result) { |  | 
| 1304   AppWindowRegistry* registry = AppWindowRegistry::Get(profile); |  | 
| 1305   if (!registry) return; |  | 
| 1306 |  | 
| 1307   const AppWindowRegistry::AppWindowList windows = |  | 
| 1308       registry->GetAppWindowsForApp(extension->id()); |  | 
| 1309 |  | 
| 1310   bool has_generated_background_page = |  | 
| 1311       BackgroundInfo::HasGeneratedBackgroundPage(extension); |  | 
| 1312   for (AppWindowRegistry::const_iterator it = windows.begin(); |  | 
| 1313        it != windows.end(); |  | 
| 1314        ++it) { |  | 
| 1315     WebContents* web_contents = (*it)->web_contents(); |  | 
| 1316     RenderViewHost* host = web_contents->GetRenderViewHost(); |  | 
| 1317     content::RenderProcessHost* process = host->GetProcess(); |  | 
| 1318 |  | 
| 1319     bool is_background_page = |  | 
| 1320         (web_contents->GetURL() == BackgroundInfo::GetBackgroundURL(extension)); |  | 
| 1321     result->push_back( |  | 
| 1322         ExtensionPage(web_contents->GetURL(), |  | 
| 1323                       process->GetID(), |  | 
| 1324                       host->GetRoutingID(), |  | 
| 1325                       process->GetBrowserContext()->IsOffTheRecord(), |  | 
| 1326                       is_background_page && has_generated_background_page)); |  | 
| 1327   } |  | 
| 1328 } |  | 
| 1329 |  | 
| 1330 void ExtensionSettingsHandler::OnReinstallComplete( | 1185 void ExtensionSettingsHandler::OnReinstallComplete( | 
| 1331     bool success, | 1186     bool success, | 
| 1332     const std::string& error, | 1187     const std::string& error, | 
| 1333     webstore_install::Result result) { | 1188     webstore_install::Result result) { | 
| 1334   MaybeUpdateAfterNotification(); | 1189   MaybeUpdateAfterNotification(); | 
| 1335 } | 1190 } | 
| 1336 | 1191 | 
| 1337 }  // namespace extensions | 1192 }  // namespace extensions | 
| OLD | NEW | 
|---|