| 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
|
| +}
|
|
|