| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // Watch a webcontents and remove URL from the history once loading is complete. | 420 // Watch a webcontents and remove URL from the history once loading is complete. |
| 421 // We have to delay the cleaning until the new URL has finished loading because | 421 // We have to delay the cleaning until the new URL has finished loading because |
| 422 // we're not allowed to remove the last-loaded URL from the history. Objects | 422 // we're not allowed to remove the last-loaded URL from the history. Objects |
| 423 // of this type automatically self-destruct once they're finished their work. | 423 // of this type automatically self-destruct once they're finished their work. |
| 424 class CurrentHistoryCleaner : public content::WebContentsObserver { | 424 class CurrentHistoryCleaner : public content::WebContentsObserver { |
| 425 public: | 425 public: |
| 426 explicit CurrentHistoryCleaner(content::WebContents* contents); | 426 explicit CurrentHistoryCleaner(content::WebContents* contents); |
| 427 virtual ~CurrentHistoryCleaner(); | 427 virtual ~CurrentHistoryCleaner(); |
| 428 | 428 |
| 429 // content::WebContentsObserver: | 429 // content::WebContentsObserver: |
| 430 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; | 430 virtual void WebContentsDestroyed() OVERRIDE; |
| 431 virtual void DidCommitProvisionalLoadForFrame( | 431 virtual void DidCommitProvisionalLoadForFrame( |
| 432 int64 frame_id, | 432 int64 frame_id, |
| 433 const base::string16& frame_unique_name, | 433 const base::string16& frame_unique_name, |
| 434 bool is_main_frame, | 434 bool is_main_frame, |
| 435 const GURL& url, | 435 const GURL& url, |
| 436 content::PageTransition transition_type, | 436 content::PageTransition transition_type, |
| 437 content::RenderViewHost* render_view_host) OVERRIDE; | 437 content::RenderViewHost* render_view_host) OVERRIDE; |
| 438 | 438 |
| 439 private: | 439 private: |
| 440 scoped_ptr<content::WebContents> contents_; | 440 scoped_ptr<content::WebContents> contents_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 content::NavigationEntry* entry = | 473 content::NavigationEntry* entry = |
| 474 nc->GetEntryAtIndex(history_index_to_remove_); | 474 nc->GetEntryAtIndex(history_index_to_remove_); |
| 475 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) { | 475 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) { |
| 476 hs->DeleteURL(entry->GetURL()); | 476 hs->DeleteURL(entry->GetURL()); |
| 477 nc->RemoveEntryAtIndex(history_index_to_remove_); | 477 nc->RemoveEntryAtIndex(history_index_to_remove_); |
| 478 delete this; // Success. | 478 delete this; // Success. |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 void CurrentHistoryCleaner::WebContentsDestroyed( | 483 void CurrentHistoryCleaner::WebContentsDestroyed() { |
| 484 content::WebContents* contents) { | |
| 485 delete this; // Failure. | 484 delete this; // Failure. |
| 486 } | 485 } |
| 487 | 486 |
| 488 } // namespace | 487 } // namespace |
| 489 | 488 |
| 490 | 489 |
| 491 // StartSyncArgs -------------------------------------------------------------- | 490 // StartSyncArgs -------------------------------------------------------------- |
| 492 | 491 |
| 493 OneClickSigninHelper::StartSyncArgs::StartSyncArgs() | 492 OneClickSigninHelper::StartSyncArgs::StartSyncArgs() |
| 494 : profile(NULL), | 493 : profile(NULL), |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1598 // If the web contents is showing a blank page and not about to be closed, | 1597 // If the web contents is showing a blank page and not about to be closed, |
| 1599 // redirect to the NTP or apps page. | 1598 // redirect to the NTP or apps page. |
| 1600 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && | 1599 if (signin::IsContinueUrlForWebBasedSigninFlow(current_url) && |
| 1601 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { | 1600 !signin::IsAutoCloseEnabledInURL(original_continue_url_)) { |
| 1602 RedirectToNtpOrAppsPage( | 1601 RedirectToNtpOrAppsPage( |
| 1603 web_contents(), | 1602 web_contents(), |
| 1604 signin::GetSourceForPromoURL(original_continue_url_)); | 1603 signin::GetSourceForPromoURL(original_continue_url_)); |
| 1605 } | 1604 } |
| 1606 } | 1605 } |
| 1607 } | 1606 } |
| OLD | NEW |