Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Unified Diff: chrome/browser/chromeos/profiles/profile_helper.cc

Issue 1012083002: Resolve new GAIA flow's infinite loop. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear storage partition in ProfileHelper::ClearSigninProfile. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/profiles/profile_helper.cc
diff --git a/chrome/browser/chromeos/profiles/profile_helper.cc b/chrome/browser/chromeos/profiles/profile_helper.cc
index 7e69cc750886fc814ae7e2e144f78d17462ec4ef..28350e27ce21ec5170339e980b68f5df4a914b4f 100644
--- a/chrome/browser/chromeos/profiles/profile_helper.cc
+++ b/chrome/browser/chromeos/profiles/profile_helper.cc
@@ -18,6 +18,11 @@
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/storage_partition.h"
+#include "content/public/browser/web_contents.h"
+#include "extensions/browser/guest_view/guest_view_base.h"
+#include "extensions/browser/guest_view/guest_view_manager.h"
+#include "extensions/browser/guest_view/web_view/web_view_guest.h"
namespace chromeos {
@@ -197,8 +202,38 @@ void ProfileHelper::Initialize() {
user_manager::UserManager::Get()->AddSessionStateObserver(this);
}
-void ProfileHelper::ClearSigninProfile(const base::Closure& on_clear_callback) {
- on_clear_callbacks_.push_back(on_clear_callback);
+static bool ClearWebViewData(const base::Closure& on_clear_callback,
+ content::WebContents* web_contents) {
+ extensions::GuestViewBase* guest_view =
+ extensions::GuestViewBase::FromWebContents(web_contents);
+ if (guest_view->GetViewType() == extensions::WebViewGuest::Type) {
Fady Samuel 2015/03/19 11:15:56 This is unnecessarily complex. All of this can be
Ivan Podogov 2015/03/19 11:56:32 This won't work: the WebContents that is passed he
Fady Samuel 2015/03/19 12:14:30 I'm confused. GuestViewBase::FromWebContents does
Ivan Podogov 2015/03/19 12:18:43 Ah, I thought you were talking about replacing the
Ivan Podogov 2015/03/19 12:29:21 Done.
+ extensions::WebViewGuest* view_guest =
+ static_cast<extensions::WebViewGuest*>(guest_view);
+ view_guest->ClearData(base::Time(),
+ content::StoragePartition::REMOVE_DATA_MASK_ALL,
+ on_clear_callback);
+ return true;
+ }
+ return false;
+}
+
+static void ClearContentsData(content::WebContents* web_contents,
+ const base::Closure& on_clear_callback) {
+ content::BrowserContext* context = web_contents->GetBrowserContext();
+ extensions::GuestViewManager* manager =
+ extensions::GuestViewManager::FromBrowserContext(context);
+ if (!manager->ForEachGuest(
+ web_contents, base::Bind(&ClearWebViewData, on_clear_callback))) {
+ on_clear_callback.Run();
+ }
+}
+
+void ProfileHelper::ClearSigninProfile(const base::Closure& on_clear_callback,
+ content::WebContents* webview_contents) {
+ on_clear_callbacks_.push_back(
+ webview_contents
+ ? base::Bind(&ClearContentsData, webview_contents, on_clear_callback)
+ : on_clear_callback);
if (signin_profile_clear_requested_)
return;
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -350,7 +385,7 @@ void ProfileHelper::OnSessionRestoreStateChanged(
chromeos::OAuth2LoginManagerFactory::GetInstance()->
GetForProfile(user_profile);
login_manager->RemoveObserver(this);
- ClearSigninProfile(base::Closure());
+ ClearSigninProfile(base::Closure(), nullptr);
}
}
« no previous file with comments | « chrome/browser/chromeos/profiles/profile_helper.h ('k') | chrome/browser/resources/gaia_auth_host/authenticator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698