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