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

Side by Side Diff: chrome/browser/sessions/session_service.cc

Issue 10827168: Fix user agent override restore pipeline (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebasing Created 8 years, 4 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 unified diff | Download patch
OLDNEW
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/sessions/session_service.h" 5 #include "chrome/browser/sessions/session_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED, 512 registrar_.Add(this, chrome::NOTIFICATION_TAB_PARENTED,
513 content::NotificationService::AllSources()); 513 content::NotificationService::AllSources());
514 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED, 514 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED,
515 content::NotificationService::AllSources()); 515 content::NotificationService::AllSources());
516 registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, 516 registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED,
517 content::NotificationService::AllSources()); 517 content::NotificationService::AllSources());
518 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED, 518 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED,
519 content::NotificationService::AllSources()); 519 content::NotificationService::AllSources());
520 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, 520 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
521 content::NotificationService::AllSources()); 521 content::NotificationService::AllSources());
522 registrar_.Add(
523 this, content::NOTIFICATION_WEB_CONTENTS_USER_AGENT_OVERRIDE_CHANGED,
524 content::NotificationService::AllSources());
522 // Wait for NOTIFICATION_BROWSER_WINDOW_READY so that is_app() is set. 525 // Wait for NOTIFICATION_BROWSER_WINDOW_READY so that is_app() is set.
523 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, 526 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY,
524 content::NotificationService::AllBrowserContextsAndSources()); 527 content::NotificationService::AllBrowserContextsAndSources());
525 registrar_.Add( 528 registrar_.Add(
526 this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, 529 this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
527 content::NotificationService::AllSources()); 530 content::NotificationService::AllSources());
528 } 531 }
529 532
530 bool SessionService::ShouldNewWindowStartSession() { 533 bool SessionService::ShouldNewWindowStartSession() {
531 // ChromeOS and OSX have different ideas of application lifetime than 534 // ChromeOS and OSX have different ideas of application lifetime than
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 content::Details<content::LoadCommittedDetails> changed(details); 696 content::Details<content::LoadCommittedDetails> changed(details);
694 if (changed->type == content::NAVIGATION_TYPE_NEW_PAGE || 697 if (changed->type == content::NAVIGATION_TYPE_NEW_PAGE ||
695 changed->type == content::NAVIGATION_TYPE_EXISTING_PAGE) { 698 changed->type == content::NAVIGATION_TYPE_EXISTING_PAGE) {
696 RecordSessionUpdateHistogramData( 699 RecordSessionUpdateHistogramData(
697 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 700 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
698 &last_updated_nav_entry_commit_time_); 701 &last_updated_nav_entry_commit_time_);
699 } 702 }
700 break; 703 break;
701 } 704 }
702 705
706 case content::NOTIFICATION_WEB_CONTENTS_USER_AGENT_OVERRIDE_CHANGED: {
707 TabContents* tab = TabContents::FromWebContents(
708 content::Source<content::WebContents>(source).ptr());
709 if (!tab || tab->profile() != profile())
710 return;
711 SetTabUserAgentOverride(tab->restore_tab_helper()->window_id(),
712 tab->restore_tab_helper()->session_id(),
713 tab->web_contents()->GetUserAgentOverride());
714 break;
715 }
716
703 case chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: { 717 case chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: {
704 extensions::TabHelper* extension_tab_helper = 718 extensions::TabHelper* extension_tab_helper =
705 content::Source<extensions::TabHelper>(source).ptr(); 719 content::Source<extensions::TabHelper>(source).ptr();
706 if (extension_tab_helper->tab_contents()->profile() != profile()) 720 if (extension_tab_helper->tab_contents()->profile() != profile())
707 return; 721 return;
708 if (extension_tab_helper->extension_app()) { 722 if (extension_tab_helper->extension_app()) {
709 RestoreTabHelper* helper = 723 RestoreTabHelper* helper =
710 extension_tab_helper->tab_contents()->restore_tab_helper(); 724 extension_tab_helper->tab_contents()->restore_tab_helper();
711 SetTabExtensionAppID(helper->window_id(), 725 SetTabExtensionAppID(helper->window_id(),
712 helper->session_id(), 726 helper->session_id(),
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 50); 1745 50);
1732 if (use_long_period) { 1746 if (use_long_period) {
1733 std::string long_name_("SessionRestore.SaveLongPeriod"); 1747 std::string long_name_("SessionRestore.SaveLongPeriod");
1734 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, 1748 UMA_HISTOGRAM_CUSTOM_TIMES(long_name_,
1735 delta, 1749 delta,
1736 save_delay_in_mins_, 1750 save_delay_in_mins_,
1737 save_delay_in_hrs_, 1751 save_delay_in_hrs_,
1738 50); 1752 50);
1739 } 1753 }
1740 } 1754 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698