Index: chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc |
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc |
index 5d72124298f48283832b7f02f6a822e7f1555288..82c5c815d12513402c276469cb173bce306aa4db 100644 |
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc |
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc |
@@ -38,6 +38,9 @@ |
#include "components/user_manager/user_manager.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_frame_host.h" |
+#include "content/public/browser/storage_partition.h" |
+#include "content/public/browser/web_contents.h" |
+#include "content/public/common/url_constants.h" |
#include "google_apis/gaia/gaia_auth_util.h" |
#include "google_apis/gaia/gaia_switches.h" |
#include "google_apis/gaia/gaia_urls.h" |
@@ -643,6 +646,31 @@ void GaiaScreenHandler::OnDnsCleared() { |
void GaiaScreenHandler::StartClearingCookies( |
const base::Closure& on_clear_callback) { |
cookies_cleared_ = false; |
+ |
+ 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
|
+ content::WebContents* contents = web_ui()->GetWebContents(); |
+ content::BrowserContext* context = contents->GetBrowserContext(); |
+ GURL guest_url(std::string(content::kGuestScheme) + |
+ url::kStandardSchemeSeparator + |
+ 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
|
+ content::StoragePartition* partition = |
+ content::BrowserContext::GetStoragePartitionForSite(context, guest_url); |
+ DCHECK(partition); |
+ 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
|
+ 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.
|
+ partition->ClearData( |
+ content::StoragePartition::REMOVE_DATA_MASK_ALL, |
+ content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, GURL(), |
+ content::StoragePartition::OriginMatcherFunction(), base::Time(), |
+ base::Time::Now(), |
+ base::Bind(&GaiaScreenHandler::OnCookiesCleared, |
+ weak_factory_.GetWeakPtr(), on_clear_callback)); |
+ return; |
+ } 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.
|
+ LOG(ERROR) << "Storage partition not found for " << guest_url.spec(); |
+ } |
+ } |
+ |
ProfileHelper* profile_helper = ProfileHelper::Get(); |
LOG_ASSERT(Profile::FromWebUI(web_ui()) == |
profile_helper->GetSigninProfile()); |