Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/options/website_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/website_settings_handler.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/content_settings_utils.h" | 7 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 {"storageTabLabel", IDS_WEBSITE_SETTINGS_TYPE_STORAGE}, | 103 {"storageTabLabel", IDS_WEBSITE_SETTINGS_TYPE_STORAGE}, |
| 104 {"batteryTabLabel", IDS_WEBSITE_SETTINGS_TYPE_BATTERY}, | 104 {"batteryTabLabel", IDS_WEBSITE_SETTINGS_TYPE_BATTERY}, |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 RegisterStrings(localized_strings, resources, arraysize(resources)); | 107 RegisterStrings(localized_strings, resources, arraysize(resources)); |
| 108 RegisterTitle( | 108 RegisterTitle( |
| 109 localized_strings, "websiteSettingsPage", IDS_WEBSITE_SETTINGS_TITLE); | 109 localized_strings, "websiteSettingsPage", IDS_WEBSITE_SETTINGS_TITLE); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void WebsiteSettingsHandler::InitializeHandler() { | 112 void WebsiteSettingsHandler::InitializeHandler() { |
| 113 Profile* profile = Profile::FromWebUI(web_ui()); | 113 Profile* profile = GetProfile(); |
| 114 HostContentSettingsMap* settings = profile->GetHostContentSettingsMap(); | 114 HostContentSettingsMap* settings = profile->GetHostContentSettingsMap(); |
| 115 observer_.Add(settings); | 115 observer_.Add(settings); |
| 116 | 116 |
| 117 power::OriginPowerMap* origin_power_map = | 117 power::OriginPowerMap* origin_power_map = |
| 118 power::OriginPowerMapFactory::GetForBrowserContext(profile); | 118 power::OriginPowerMapFactory::GetForBrowserContext(profile); |
| 119 // OriginPowerMap may not be available in tests. | 119 // OriginPowerMap may not be available in tests. |
| 120 if (origin_power_map) { | 120 if (origin_power_map) { |
| 121 subscription_ = origin_power_map->AddPowerConsumptionUpdatedCallback( | 121 subscription_ = origin_power_map->AddPowerConsumptionUpdatedCallback( |
| 122 base::Bind(&WebsiteSettingsHandler::Update, base::Unretained(this))); | 122 base::Bind(&WebsiteSettingsHandler::Update, base::Unretained(this))); |
| 123 } | 123 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 const base::ListValue* args) { | 221 const base::ListValue* args) { |
| 222 bool rv = args->GetString(0, &last_filter_); | 222 bool rv = args->GetString(0, &last_filter_); |
| 223 DCHECK(rv); | 223 DCHECK(rv); |
| 224 | 224 |
| 225 Update(); | 225 Update(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void WebsiteSettingsHandler::HandleUpdateLocalStorage( | 228 void WebsiteSettingsHandler::HandleUpdateLocalStorage( |
| 229 const base::ListValue* args) { | 229 const base::ListValue* args) { |
| 230 if (!local_storage_.get()) { | 230 if (!local_storage_.get()) { |
| 231 Profile* profile = Profile::FromWebUI(web_ui()); | 231 Profile* profile = GetProfile(); |
| 232 local_storage_ = new BrowsingDataLocalStorageHelper(profile); | 232 local_storage_ = new BrowsingDataLocalStorageHelper(profile); |
| 233 } | 233 } |
| 234 | 234 |
| 235 last_setting_ = kStorage; | 235 last_setting_ = kStorage; |
| 236 | 236 |
| 237 local_storage_->StartFetching( | 237 local_storage_->StartFetching( |
| 238 base::Bind(&WebsiteSettingsHandler::OnLocalStorageFetched, | 238 base::Bind(&WebsiteSettingsHandler::OnLocalStorageFetched, |
| 239 weak_ptr_factory_.GetWeakPtr())); | 239 weak_ptr_factory_.GetWeakPtr())); |
| 240 } | 240 } |
| 241 | 241 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 266 DCHECK(!last_setting_.empty()); | 266 DCHECK(!last_setting_.empty()); |
| 267 if (last_setting_ == kStorage) | 267 if (last_setting_ == kStorage) |
| 268 UpdateLocalStorage(); | 268 UpdateLocalStorage(); |
| 269 else if (last_setting_ == kBattery) | 269 else if (last_setting_ == kBattery) |
| 270 UpdateBatteryUsage(); | 270 UpdateBatteryUsage(); |
| 271 else | 271 else |
| 272 UpdateOrigins(); | 272 UpdateOrigins(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void WebsiteSettingsHandler::UpdateOrigins() { | 275 void WebsiteSettingsHandler::UpdateOrigins() { |
| 276 Profile* profile = Profile::FromWebUI(web_ui()); | 276 Profile* profile = GetProfile(); |
| 277 HostContentSettingsMap* settings = profile->GetHostContentSettingsMap(); | 277 HostContentSettingsMap* settings = profile->GetHostContentSettingsMap(); |
| 278 | 278 |
| 279 ContentSettingsForOneType all_settings; | 279 ContentSettingsForOneType all_settings; |
| 280 ContentSettingsType last_setting; | 280 ContentSettingsType last_setting; |
| 281 content_settings::GetTypeFromName(last_setting_, &last_setting); | 281 content_settings::GetTypeFromName(last_setting_, &last_setting); |
| 282 | 282 |
| 283 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM) | 283 if (last_setting == CONTENT_SETTINGS_TYPE_MEDIASTREAM) |
| 284 last_setting = CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; | 284 last_setting = CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; |
| 285 | 285 |
| 286 settings->GetSettingsForOneType(last_setting, std::string(), &all_settings); | 286 settings->GetSettingsForOneType(last_setting, std::string(), &all_settings); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 DCHECK(rv); | 372 DCHECK(rv); |
| 373 ContentSettingsType settings_type; | 373 ContentSettingsType settings_type; |
| 374 rv = content_settings::GetTypeFromName(setting_name, &settings_type); | 374 rv = content_settings::GetTypeFromName(setting_name, &settings_type); |
| 375 DCHECK(rv); | 375 DCHECK(rv); |
| 376 | 376 |
| 377 std::string value; | 377 std::string value; |
| 378 rv = args->GetString(1, &value); | 378 rv = args->GetString(1, &value); |
| 379 DCHECK(rv); | 379 DCHECK(rv); |
| 380 | 380 |
| 381 ContentSetting setting = content_settings::ContentSettingFromString(value); | 381 ContentSetting setting = content_settings::ContentSettingFromString(value); |
| 382 Profile* profile = Profile::FromWebUI(web_ui()); | 382 Profile* profile = GetProfile(); |
| 383 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 383 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 384 ContentSetting default_value = | 384 ContentSetting default_value = |
| 385 map->GetDefaultContentSetting(settings_type, NULL); | 385 map->GetDefaultContentSetting(settings_type, NULL); |
| 386 | 386 |
| 387 // Users are not allowed to be the source of the "ask" setting. It is an | 387 // Users are not allowed to be the source of the "ask" setting. It is an |
| 388 // ephemeral setting which is removed once the question is asked. | 388 // ephemeral setting which is removed once the question is asked. |
| 389 if (setting == CONTENT_SETTING_ASK && setting == default_value) | 389 if (setting == CONTENT_SETTING_ASK && setting == default_value) |
| 390 setting = CONTENT_SETTING_DEFAULT; | 390 setting = CONTENT_SETTING_DEFAULT; |
| 391 | 391 |
| 392 ContentSettingsPattern primary_pattern; | 392 ContentSettingsPattern primary_pattern; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 std::string setting; | 476 std::string setting; |
| 477 if (!args->GetString(0, &setting)) { | 477 if (!args->GetString(0, &setting)) { |
| 478 NOTREACHED(); | 478 NOTREACHED(); |
| 479 return; | 479 return; |
| 480 } | 480 } |
| 481 ContentSetting new_default = | 481 ContentSetting new_default = |
| 482 content_settings::ContentSettingFromString(setting); | 482 content_settings::ContentSettingFromString(setting); |
| 483 | 483 |
| 484 ContentSettingsType last_setting; | 484 ContentSettingsType last_setting; |
| 485 content_settings::GetTypeFromName(last_setting_, &last_setting); | 485 content_settings::GetTypeFromName(last_setting_, &last_setting); |
| 486 Profile* profile = Profile::FromWebUI(web_ui()); | 486 Profile* profile = GetProfile(); |
| 487 | |
| 488 #if defined(OS_CHROMEOS) | |
| 489 // ChromeOS special case : in Guest mode settings are opened in Incognito | |
| 490 // mode, so we need original profile to actually modify settings. | |
| 491 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) | |
| 492 profile = profile->GetOriginalProfile(); | |
| 493 #endif | |
| 494 | 487 |
| 495 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 488 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 496 map->SetDefaultContentSetting(last_setting, new_default); | 489 map->SetDefaultContentSetting(last_setting, new_default); |
| 497 | 490 |
| 498 switch (last_setting) { | 491 switch (last_setting) { |
| 499 case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: | 492 case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: |
| 500 content::RecordAction( | 493 content::RecordAction( |
| 501 UserMetricsAction("Options_DefaultMultipleAutomaticDLSettingChange")); | 494 UserMetricsAction("Options_DefaultMultipleAutomaticDLSettingChange")); |
| 502 break; | 495 break; |
| 503 case CONTENT_SETTINGS_TYPE_COOKIES: | 496 case CONTENT_SETTINGS_TYPE_COOKIES: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 const base::ListValue* args) { | 535 const base::ListValue* args) { |
| 543 DCHECK_EQ(1U, args->GetSize()); | 536 DCHECK_EQ(1U, args->GetSize()); |
| 544 bool is_enabled; | 537 bool is_enabled; |
| 545 bool rv = args->GetBoolean(0, &is_enabled); | 538 bool rv = args->GetBoolean(0, &is_enabled); |
| 546 DCHECK(rv); | 539 DCHECK(rv); |
| 547 | 540 |
| 548 ContentSettingsType last_setting; | 541 ContentSettingsType last_setting; |
| 549 rv = content_settings::GetTypeFromName(last_setting_, &last_setting); | 542 rv = content_settings::GetTypeFromName(last_setting_, &last_setting); |
| 550 DCHECK(rv); | 543 DCHECK(rv); |
| 551 | 544 |
| 552 Profile* profile = Profile::FromWebUI(web_ui()); | 545 Profile* profile = GetProfile(); |
| 553 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 546 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 554 map->SetContentSettingOverride(last_setting, is_enabled); | 547 map->SetContentSettingOverride(last_setting, is_enabled); |
| 555 } | 548 } |
| 556 | 549 |
| 557 void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url, | 550 void WebsiteSettingsHandler::GetInfoForOrigin(const GURL& site_url, |
| 558 bool show_page) { | 551 bool show_page) { |
| 559 Profile* profile = Profile::FromWebUI(web_ui()); | 552 Profile* profile = GetProfile(); |
| 560 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); | 553 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); |
| 561 | 554 |
| 562 double storage = 0.0; | 555 double storage = 0.0; |
| 563 for (LocalStorageList::const_iterator it = local_storage_list_.begin(); | 556 for (LocalStorageList::const_iterator it = local_storage_list_.begin(); |
| 564 it != local_storage_list_.end(); | 557 it != local_storage_list_.end(); |
| 565 it++) { | 558 it++) { |
| 566 if (it->origin_url == site_url) { | 559 if (it->origin_url == site_url) { |
| 567 storage = static_cast<double>(it->size); | 560 storage = static_cast<double>(it->size); |
| 568 break; | 561 break; |
| 569 } | 562 } |
| 570 } | 563 } |
| 571 | 564 |
| 572 int battery = 0; | 565 int battery = 0; |
| 573 battery = OriginPowerMapFactory::GetForBrowserContext( | 566 battery = OriginPowerMapFactory::GetForBrowserContext( |
| 574 Profile::FromWebUI(web_ui()))->GetPowerForOrigin(site_url); | 567 GetProfile())->GetPowerForOrigin(site_url); |
| 575 | 568 |
| 576 base::DictionaryValue* permissions = new base::DictionaryValue; | 569 base::DictionaryValue* permissions = new base::DictionaryValue; |
| 577 for (size_t i = 0; i < arraysize(kValidTypes); ++i) { | 570 for (size_t i = 0; i < arraysize(kValidTypes); ++i) { |
| 578 ContentSettingsType permission_type = kValidTypes[i]; | 571 ContentSettingsType permission_type = kValidTypes[i]; |
| 579 | 572 |
| 580 // Append the possible settings. | 573 // Append the possible settings. |
| 581 base::ListValue* options = new base::ListValue; | 574 base::ListValue* options = new base::ListValue; |
| 582 ContentSetting default_value = | 575 ContentSetting default_value = |
| 583 map->GetDefaultContentSetting(permission_type, NULL); | 576 map->GetDefaultContentSetting(permission_type, NULL); |
| 584 if (default_value != CONTENT_SETTING_ALLOW && | 577 if (default_value != CONTENT_SETTING_ALLOW && |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 "readableName", GetReadableName(it->origin_url)); | 657 "readableName", GetReadableName(it->origin_url)); |
| 665 local_storage_map.SetWithoutPathExpansion(origin, origin_entry); | 658 local_storage_map.SetWithoutPathExpansion(origin, origin_entry); |
| 666 } | 659 } |
| 667 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", | 660 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", |
| 668 local_storage_map); | 661 local_storage_map); |
| 669 } | 662 } |
| 670 | 663 |
| 671 void WebsiteSettingsHandler::UpdateBatteryUsage() { | 664 void WebsiteSettingsHandler::UpdateBatteryUsage() { |
| 672 base::DictionaryValue power_map; | 665 base::DictionaryValue power_map; |
| 673 OriginPowerMap* origins = | 666 OriginPowerMap* origins = |
| 674 OriginPowerMapFactory::GetForBrowserContext(Profile::FromWebUI(web_ui())); | 667 OriginPowerMapFactory::GetForBrowserContext(GetProfile()); |
| 675 OriginPowerMap::PercentOriginMap percent_map = origins->GetPercentOriginMap(); | 668 OriginPowerMap::PercentOriginMap percent_map = origins->GetPercentOriginMap(); |
| 676 for (std::map<GURL, int>::iterator it = percent_map.begin(); | 669 for (std::map<GURL, int>::iterator it = percent_map.begin(); |
| 677 it != percent_map.end(); | 670 it != percent_map.end(); |
| 678 ++it) { | 671 ++it) { |
| 679 std::string origin = it->first.spec(); | 672 std::string origin = it->first.spec(); |
| 680 | 673 |
| 681 if (origin.find(last_filter_) == base::string16::npos) | 674 if (origin.find(last_filter_) == base::string16::npos) |
| 682 continue; | 675 continue; |
| 683 | 676 |
| 684 base::DictionaryValue* origin_entry = new base::DictionaryValue(); | 677 base::DictionaryValue* origin_entry = new base::DictionaryValue(); |
| 685 origin_entry->SetInteger("usage", it->second); | 678 origin_entry->SetInteger("usage", it->second); |
| 686 origin_entry->SetString( | 679 origin_entry->SetString( |
| 687 "usageString", | 680 "usageString", |
| 688 l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT, | 681 l10n_util::GetStringFUTF16Int(IDS_WEBSITE_SETTINGS_BATTERY_PERCENT, |
| 689 it->second)); | 682 it->second)); |
| 690 origin_entry->SetStringWithoutPathExpansion("readableName", | 683 origin_entry->SetStringWithoutPathExpansion("readableName", |
| 691 GetReadableName(it->first)); | 684 GetReadableName(it->first)); |
| 692 power_map.SetWithoutPathExpansion(origin, origin_entry); | 685 power_map.SetWithoutPathExpansion(origin, origin_entry); |
| 693 } | 686 } |
| 694 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", | 687 web_ui()->CallJavascriptFunction("WebsiteSettingsManager.populateOrigins", |
| 695 power_map); | 688 power_map); |
| 696 } | 689 } |
| 697 | 690 |
| 698 std::string WebsiteSettingsHandler::GetSettingDefaultFromModel( | 691 std::string WebsiteSettingsHandler::GetSettingDefaultFromModel( |
| 699 ContentSettingsType type, | 692 ContentSettingsType type, |
| 700 std::string* provider_id) { | 693 std::string* provider_id) { |
| 701 Profile* profile = Profile::FromWebUI(web_ui()); | 694 Profile* profile = GetProfile(); |
| 702 ContentSetting default_setting = | 695 ContentSetting default_setting = |
| 703 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( | 696 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( |
| 704 type, provider_id); | 697 type, provider_id); |
| 705 | 698 |
| 706 return content_settings::ContentSettingToString(default_setting); | 699 return content_settings::ContentSettingToString(default_setting); |
| 707 } | 700 } |
| 708 | 701 |
| 709 void WebsiteSettingsHandler::StopOrigin(const GURL& site_url) { | 702 void WebsiteSettingsHandler::StopOrigin(const GURL& site_url) { |
| 710 Profile* profile = Profile::FromWebUI(web_ui()); | 703 Profile* profile = GetProfile(); |
| 711 if (site_url.SchemeIs(extensions::kExtensionScheme)) { | 704 if (site_url.SchemeIs(extensions::kExtensionScheme)) { |
| 712 const extensions::Extension* extension = | 705 const extensions::Extension* extension = |
| 713 extensions::ExtensionRegistry::Get(profile) | 706 extensions::ExtensionRegistry::Get(profile) |
| 714 ->enabled_extensions() | 707 ->enabled_extensions() |
| 715 .GetHostedAppByURL(site_url); | 708 .GetHostedAppByURL(site_url); |
| 716 if (extension) { | 709 if (extension) { |
| 717 extensions::AppWindowRegistry::Get(profile) | 710 extensions::AppWindowRegistry::Get(profile) |
| 718 ->CloseAllAppWindowsForApp(extension->id()); | 711 ->CloseAllAppWindowsForApp(extension->id()); |
| 719 } | 712 } |
| 720 } | 713 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 733 profile != | 726 profile != |
| 734 Profile::FromBrowserContext(web_contents->GetBrowserContext())) { | 727 Profile::FromBrowserContext(web_contents->GetBrowserContext())) { |
| 735 continue; | 728 continue; |
| 736 } | 729 } |
| 737 model->DiscardWebContentsAt(idx); | 730 model->DiscardWebContentsAt(idx); |
| 738 } | 731 } |
| 739 } | 732 } |
| 740 } | 733 } |
| 741 | 734 |
| 742 void WebsiteSettingsHandler::DeleteLocalStorage(const GURL& site_url) { | 735 void WebsiteSettingsHandler::DeleteLocalStorage(const GURL& site_url) { |
| 743 Profile* profile = Profile::FromWebUI(web_ui()); | 736 Profile* profile = GetProfile(); |
| 744 content::DOMStorageContext* dom_storage_context_ = | 737 content::DOMStorageContext* dom_storage_context_ = |
| 745 content::BrowserContext::GetDefaultStoragePartition(profile) | 738 content::BrowserContext::GetDefaultStoragePartition(profile) |
| 746 ->GetDOMStorageContext(); | 739 ->GetDOMStorageContext(); |
| 747 dom_storage_context_->DeleteLocalStorage(site_url); | 740 dom_storage_context_->DeleteLocalStorage(site_url); |
| 748 | 741 |
| 749 // Load a new BrowsingDataLocalStorageHelper to update. | 742 // Load a new BrowsingDataLocalStorageHelper to update. |
| 750 local_storage_ = new BrowsingDataLocalStorageHelper(profile); | 743 local_storage_ = new BrowsingDataLocalStorageHelper(profile); |
| 751 | 744 |
| 752 local_storage_->StartFetching( | 745 local_storage_->StartFetching( |
| 753 base::Bind(&WebsiteSettingsHandler::OnLocalStorageFetched, | 746 base::Bind(&WebsiteSettingsHandler::OnLocalStorageFetched, |
| 754 weak_ptr_factory_.GetWeakPtr())); | 747 weak_ptr_factory_.GetWeakPtr())); |
| 755 } | 748 } |
| 756 | 749 |
| 757 const std::string& WebsiteSettingsHandler::GetReadableName( | 750 const std::string& WebsiteSettingsHandler::GetReadableName( |
| 758 const GURL& site_url) { | 751 const GURL& site_url) { |
| 759 if (site_url.SchemeIs(extensions::kExtensionScheme)) { | 752 if (site_url.SchemeIs(extensions::kExtensionScheme)) { |
| 760 Profile* profile = Profile::FromWebUI(web_ui()); | 753 Profile* profile = GetProfile(); |
| 761 ExtensionService* extension_service = | 754 ExtensionService* extension_service = |
| 762 extensions::ExtensionSystem::Get(profile)->extension_service(); | 755 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 763 | 756 |
| 764 const extensions::Extension* extension = | 757 const extensions::Extension* extension = |
| 765 extension_service->extensions()->GetExtensionOrAppByURL(site_url); | 758 extension_service->extensions()->GetExtensionOrAppByURL(site_url); |
| 766 // If extension is NULL, it was removed and we cannot look up its name. | 759 // If extension is NULL, it was removed and we cannot look up its name. |
| 767 if (!extension) | 760 if (!extension) |
| 768 return site_url.spec(); | 761 return site_url.spec(); |
| 769 | 762 |
| 770 return extension->name(); | 763 return extension->name(); |
| 771 } | 764 } |
| 772 return site_url.spec(); | 765 return site_url.spec(); |
| 773 } | 766 } |
| 774 | 767 |
| 768 Profile* WebsiteSettingsHandler::GetProfile() { | |
| 769 Profile* profile = Profile::FromWebUI(web_ui()); | |
| 770 #if defined(OS_CHROMEOS) | |
| 771 // ChromeOS special case : in Guest mode settings are opened in Incognito | |
|
Daniel Erat
2014/09/19 00:39:42
nit: s/ChromeOS/Chrome OS/
Daniel Nishi
2014/09/19 00:50:15
Done.
| |
| 772 // mode, so we need original profile to actually modify settings. | |
| 773 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) | |
| 774 profile = profile->GetOriginalProfile(); | |
| 775 #endif | |
| 776 return profile; | |
| 777 } | |
| 778 | |
| 775 } // namespace options | 779 } // namespace options |
| OLD | NEW |