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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // Watch a webcontents and remove URL from the history once loading is complete. | 419 // Watch a webcontents and remove URL from the history once loading is complete. |
420 // We have to delay the cleaning until the new URL has finished loading because | 420 // We have to delay the cleaning until the new URL has finished loading because |
421 // we're not allowed to remove the last-loaded URL from the history. Objects | 421 // we're not allowed to remove the last-loaded URL from the history. Objects |
422 // of this type automatically self-destruct once they're finished their work. | 422 // of this type automatically self-destruct once they're finished their work. |
423 class CurrentHistoryCleaner : public content::WebContentsObserver { | 423 class CurrentHistoryCleaner : public content::WebContentsObserver { |
424 public: | 424 public: |
425 explicit CurrentHistoryCleaner(content::WebContents* contents); | 425 explicit CurrentHistoryCleaner(content::WebContents* contents); |
426 virtual ~CurrentHistoryCleaner(); | 426 virtual ~CurrentHistoryCleaner(); |
427 | 427 |
428 // content::WebContentsObserver: | 428 // content::WebContentsObserver: |
429 virtual void WebContentsDestroyed(content::WebContents* contents) OVERRIDE; | 429 virtual void WebContentsDestroyed() OVERRIDE; |
430 virtual void DidCommitProvisionalLoadForFrame( | 430 virtual void DidCommitProvisionalLoadForFrame( |
431 int64 frame_id, | 431 int64 frame_id, |
432 const base::string16& frame_unique_name, | 432 const base::string16& frame_unique_name, |
433 bool is_main_frame, | 433 bool is_main_frame, |
434 const GURL& url, | 434 const GURL& url, |
435 content::PageTransition transition_type, | 435 content::PageTransition transition_type, |
436 content::RenderViewHost* render_view_host) OVERRIDE; | 436 content::RenderViewHost* render_view_host) OVERRIDE; |
437 | 437 |
438 private: | 438 private: |
439 scoped_ptr<content::WebContents> contents_; | 439 scoped_ptr<content::WebContents> contents_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 content::NavigationEntry* entry = | 472 content::NavigationEntry* entry = |
473 nc->GetEntryAtIndex(history_index_to_remove_); | 473 nc->GetEntryAtIndex(history_index_to_remove_); |
474 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) { | 474 if (signin::IsContinueUrlForWebBasedSigninFlow(entry->GetURL())) { |
475 hs->DeleteURL(entry->GetURL()); | 475 hs->DeleteURL(entry->GetURL()); |
476 nc->RemoveEntryAtIndex(history_index_to_remove_); | 476 nc->RemoveEntryAtIndex(history_index_to_remove_); |
477 delete this; // Success. | 477 delete this; // Success. |
478 } | 478 } |
479 } | 479 } |
480 } | 480 } |
481 | 481 |
482 void CurrentHistoryCleaner::WebContentsDestroyed( | 482 void CurrentHistoryCleaner::WebContentsDestroyed() { |
483 content::WebContents* contents) { | |
484 delete this; // Failure. | 483 delete this; // Failure. |
485 } | 484 } |
486 | 485 |
487 } // namespace | 486 } // namespace |
488 | 487 |
489 | 488 |
490 // StartSyncArgs -------------------------------------------------------------- | 489 // StartSyncArgs -------------------------------------------------------------- |
491 | 490 |
492 OneClickSigninHelper::StartSyncArgs::StartSyncArgs() | 491 OneClickSigninHelper::StartSyncArgs::StartSyncArgs() |
493 : profile(NULL), | 492 : profile(NULL), |
(...skipping 1104 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 |