| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/signin/ios/browser/account_consistency_service.h" | 5 #include "components/signin/ios/browser/account_consistency_service.h" |
| 6 | 6 |
| 7 #include <WebKit/WebKit.h> | 7 #include <WebKit/WebKit.h> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 web_view_.reset(CreateWKWebView()); | 393 web_view_.reset(CreateWKWebView()); |
| 394 navigation_delegate_.reset([[AccountConsistencyNavigationDelegate alloc] | 394 navigation_delegate_.reset([[AccountConsistencyNavigationDelegate alloc] |
| 395 initWithCallback:base::Bind(&AccountConsistencyService:: | 395 initWithCallback:base::Bind(&AccountConsistencyService:: |
| 396 FinishedApplyingCookieRequest, | 396 FinishedApplyingCookieRequest, |
| 397 base::Unretained(this), true)]); | 397 base::Unretained(this), true)]); |
| 398 [web_view_ setNavigationDelegate:navigation_delegate_]; | 398 [web_view_ setNavigationDelegate:navigation_delegate_]; |
| 399 } | 399 } |
| 400 return web_view_.get(); | 400 return web_view_.get(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 WKWebView* AccountConsistencyService::CreateWKWebView() { | 403 WKWebView* AccountConsistencyService::CreateWKWebView() NS_RETURNS_RETAINED { |
| 404 return web::CreateWKWebView(CGRectZero, browser_state_); | 404 return web::CreateWKWebView(CGRectZero, browser_state_); |
| 405 } | 405 } |
| 406 | 406 |
| 407 void AccountConsistencyService::ResetWKWebView() { | 407 void AccountConsistencyService::ResetWKWebView() { |
| 408 [web_view_ setNavigationDelegate:nil]; | 408 [web_view_ setNavigationDelegate:nil]; |
| 409 [web_view_ stopLoading]; | 409 [web_view_ stopLoading]; |
| 410 web_view_.reset(); | 410 web_view_.reset(); |
| 411 navigation_delegate_.reset(); | 411 navigation_delegate_.reset(); |
| 412 applying_cookie_requests_ = false; | 412 applying_cookie_requests_ = false; |
| 413 } | 413 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 // |browser_state_| is now active. There might be some pending cookie requests | 473 // |browser_state_| is now active. There might be some pending cookie requests |
| 474 // to apply. | 474 // to apply. |
| 475 ApplyCookieRequests(); | 475 ApplyCookieRequests(); |
| 476 } | 476 } |
| 477 | 477 |
| 478 void AccountConsistencyService::OnInactive() { | 478 void AccountConsistencyService::OnInactive() { |
| 479 // |browser_state_| is now inactive. Stop using |web_view_| and don't create | 479 // |browser_state_| is now inactive. Stop using |web_view_| and don't create |
| 480 // a new one until it is active. | 480 // a new one until it is active. |
| 481 ResetWKWebView(); | 481 ResetWKWebView(); |
| 482 } | 482 } |
| OLD | NEW |