OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/login/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "chrome/common/chrome_version_info.h" | 31 #include "chrome/common/chrome_version_info.h" |
32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
33 #include "chrome/grit/generated_resources.h" | 33 #include "chrome/grit/generated_resources.h" |
34 #include "chromeos/chromeos_switches.h" | 34 #include "chromeos/chromeos_switches.h" |
35 #include "chromeos/login/auth/user_context.h" | 35 #include "chromeos/login/auth/user_context.h" |
36 #include "chromeos/settings/cros_settings_names.h" | 36 #include "chromeos/settings/cros_settings_names.h" |
37 #include "components/login/localized_values_builder.h" | 37 #include "components/login/localized_values_builder.h" |
38 #include "components/user_manager/user_manager.h" | 38 #include "components/user_manager/user_manager.h" |
39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/render_frame_host.h" | 40 #include "content/public/browser/render_frame_host.h" |
41 #include "content/public/browser/storage_partition.h" | |
42 #include "content/public/browser/web_contents.h" | |
43 #include "content/public/common/url_constants.h" | |
41 #include "google_apis/gaia/gaia_auth_util.h" | 44 #include "google_apis/gaia/gaia_auth_util.h" |
42 #include "google_apis/gaia/gaia_switches.h" | 45 #include "google_apis/gaia/gaia_switches.h" |
43 #include "google_apis/gaia/gaia_urls.h" | 46 #include "google_apis/gaia/gaia_urls.h" |
44 #include "ui/base/ime/chromeos/input_method_manager.h" | 47 #include "ui/base/ime/chromeos/input_method_manager.h" |
45 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
46 | 49 |
47 using content::BrowserThread; | 50 using content::BrowserThread; |
48 | 51 |
49 namespace chromeos { | 52 namespace chromeos { |
50 | 53 |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 void GaiaScreenHandler::OnDnsCleared() { | 639 void GaiaScreenHandler::OnDnsCleared() { |
637 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 640 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
638 dns_clear_task_running_ = false; | 641 dns_clear_task_running_ = false; |
639 dns_cleared_ = true; | 642 dns_cleared_ = true; |
640 ShowGaiaScreenIfReady(); | 643 ShowGaiaScreenIfReady(); |
641 } | 644 } |
642 | 645 |
643 void GaiaScreenHandler::StartClearingCookies( | 646 void GaiaScreenHandler::StartClearingCookies( |
644 const base::Closure& on_clear_callback) { | 647 const base::Closure& on_clear_callback) { |
645 cookies_cleared_ = false; | 648 cookies_cleared_ = false; |
649 | |
650 if (StartupUtils::IsWebviewSigninEnabled()) { | |
xiyuan
2015/03/17 16:05:53
Can we move the webview data clearing code into Pr
Ivan Podogov
2015/03/18 07:36:20
Can we make it a separate issue? Right now we are
xiyuan
2015/03/18 16:52:27
I agree introducing gaia screen details such as We
| |
651 content::WebContents* contents = web_ui()->GetWebContents(); | |
652 content::BrowserContext* context = contents->GetBrowserContext(); | |
653 GURL guest_url(std::string(content::kGuestScheme) + | |
654 url::kStandardSchemeSeparator + | |
655 contents->GetLastCommittedURL().GetContent()); | |
xiyuan
2015/03/17 16:05:52
This is not a reliable way. I happened to chat wit
Ivan Podogov
2015/03/18 07:36:20
Potentially it will give us a list of URLs (and/or
Ivan Podogov
2015/03/18 07:53:05
Oh, and one more thing to keep in mind here: in th
xiyuan
2015/03/18 16:52:27
We can DCHECK only one guest URL is returned.
Ivan Podogov
2015/03/19 09:29:45
Hm, somehow this line still returned me the same p
| |
656 content::StoragePartition* partition = | |
657 content::BrowserContext::GetStoragePartitionForSite(context, guest_url); | |
658 DCHECK(partition); | |
659 if (partition) { | |
Roman Sorokin (ftl)
2015/03/17 17:00:41
Handling error after DCHECK is forbidden. See here
Ivan Podogov
2015/03/18 07:36:20
In fact, Dmitry asked me to do it this way, for th
| |
660 LOG(ERROR) << "Start clearing cookies for " << guest_url.spec(); | |
Roman Sorokin (ftl)
2015/03/17 17:00:41
Why is it LOG(ERROR)?
Ivan Podogov
2015/03/18 07:36:20
Forgotten debug logging, shouldn't be here.
| |
661 partition->ClearData( | |
662 content::StoragePartition::REMOVE_DATA_MASK_ALL, | |
663 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(), | |
664 content::StoragePartition::OriginMatcherFunction(), base::Time(), | |
665 base::Time::Now(), | |
666 base::Bind(&GaiaScreenHandler::OnCookiesCleared, | |
667 weak_factory_.GetWeakPtr(), on_clear_callback)); | |
668 return; | |
669 } else { | |
Roman Sorokin (ftl)
2015/03/17 17:00:41
nit: don't use else after return.
Ivan Podogov
2015/03/18 07:36:20
Done.
| |
670 LOG(ERROR) << "Storage partition not found for " << guest_url.spec(); | |
671 } | |
672 } | |
673 | |
646 ProfileHelper* profile_helper = ProfileHelper::Get(); | 674 ProfileHelper* profile_helper = ProfileHelper::Get(); |
647 LOG_ASSERT(Profile::FromWebUI(web_ui()) == | 675 LOG_ASSERT(Profile::FromWebUI(web_ui()) == |
648 profile_helper->GetSigninProfile()); | 676 profile_helper->GetSigninProfile()); |
649 profile_helper->ClearSigninProfile( | 677 profile_helper->ClearSigninProfile( |
650 base::Bind(&GaiaScreenHandler::OnCookiesCleared, | 678 base::Bind(&GaiaScreenHandler::OnCookiesCleared, |
651 weak_factory_.GetWeakPtr(), | 679 weak_factory_.GetWeakPtr(), |
652 on_clear_callback)); | 680 on_clear_callback)); |
653 } | 681 } |
654 | 682 |
655 void GaiaScreenHandler::OnCookiesCleared( | 683 void GaiaScreenHandler::OnCookiesCleared( |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 878 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
851 DCHECK(signin_screen_handler_); | 879 DCHECK(signin_screen_handler_); |
852 return signin_screen_handler_->delegate_; | 880 return signin_screen_handler_->delegate_; |
853 } | 881 } |
854 | 882 |
855 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 883 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
856 signin_screen_handler_ = handler; | 884 signin_screen_handler_ = handler; |
857 } | 885 } |
858 | 886 |
859 } // namespace chromeos | 887 } // namespace chromeos |
OLD | NEW |