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

Unified Diff: chrome/browser/sessions/session_tab_helper.cc

Issue 10891044: RestoreTabHelper > SessionTabHelper, move more session stuff into it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sessions/session_tab_helper.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_tab_helper.cc
diff --git a/chrome/browser/sessions/restore_tab_helper.cc b/chrome/browser/sessions/session_tab_helper.cc
similarity index 64%
rename from chrome/browser/sessions/restore_tab_helper.cc
rename to chrome/browser/sessions/session_tab_helper.cc
index c33cc3cec6afb24d654a8047a3f594cc642c7a56..393276ecfd57568ebdb00d79dc264c0914884b69 100644
--- a/chrome/browser/sessions/restore_tab_helper.cc
+++ b/chrome/browser/sessions/session_tab_helper.cc
@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/sessions/restore_tab_helper.h"
+#include "chrome/browser/sessions/session_tab_helper.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sessions/session_service.h"
+#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension_messages.h"
@@ -11,16 +14,14 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
-using content::WebContents;
-
-RestoreTabHelper::RestoreTabHelper(WebContents* contents)
+SessionTabHelper::SessionTabHelper(content::WebContents* contents)
: content::WebContentsObserver(contents) {
}
-RestoreTabHelper::~RestoreTabHelper() {
+SessionTabHelper::~SessionTabHelper() {
}
-void RestoreTabHelper::SetWindowID(const SessionID& id) {
+void SessionTabHelper::SetWindowID(const SessionID& id) {
window_id_ = id;
// TODO(mpcomplete): Maybe this notification should send out a WebContents.
@@ -39,9 +40,19 @@ void RestoreTabHelper::SetWindowID(const SessionID& id) {
web_contents()->GetRenderViewHost()->GetRoutingID(), id.id()));
}
-void RestoreTabHelper::RenderViewCreated(
+void SessionTabHelper::RenderViewCreated(
content::RenderViewHost* render_view_host) {
render_view_host->Send(
new ExtensionMsg_UpdateBrowserWindowId(render_view_host->GetRoutingID(),
window_id_.id()));
}
+
+void SessionTabHelper::UserAgentOverrideSet(const std::string& user_agent) {
+#if defined(ENABLE_SESSION_SERVICE)
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
+ SessionService* session = SessionServiceFactory::GetForProfile(profile);
+ if (session)
+ session->SetTabUserAgentOverride(window_id(), session_id(), user_agent);
+#endif
+}
« no previous file with comments | « chrome/browser/sessions/session_tab_helper.h ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698