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

Side by Side Diff: chrome/browser/extensions/tab_helper.cc

Issue 1321713005: Abstract WebContents/NavigationController from core TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years, 3 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/extensions/tab_helper.h" 5 #include "chrome/browser/extensions/tab_helper.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/ui/browser_commands.h" 26 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_dialogs.h" 27 #include "chrome/browser/ui/browser_dialogs.h"
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/host_desktop.h" 29 #include "chrome/browser/ui/host_desktop.h"
30 #include "chrome/browser/web_applications/web_app.h" 30 #include "chrome/browser/web_applications/web_app.h"
31 #include "chrome/common/extensions/chrome_extension_messages.h" 31 #include "chrome/common/extensions/chrome_extension_messages.h"
32 #include "chrome/common/extensions/extension_constants.h" 32 #include "chrome/common/extensions/extension_constants.h"
33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 33 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
34 #include "chrome/common/render_messages.h" 34 #include "chrome/common/render_messages.h"
35 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
36 #include "components/sessions/content/content_open_tab.h"
36 #include "content/public/browser/invalidate_type.h" 37 #include "content/public/browser/invalidate_type.h"
37 #include "content/public/browser/navigation_controller.h" 38 #include "content/public/browser/navigation_controller.h"
38 #include "content/public/browser/navigation_details.h" 39 #include "content/public/browser/navigation_details.h"
39 #include "content/public/browser/navigation_entry.h" 40 #include "content/public/browser/navigation_entry.h"
40 #include "content/public/browser/notification_service.h" 41 #include "content/public/browser/notification_service.h"
41 #include "content/public/browser/notification_source.h" 42 #include "content/public/browser/notification_source.h"
42 #include "content/public/browser/notification_types.h" 43 #include "content/public/browser/notification_types.h"
43 #include "content/public/browser/render_frame_host.h" 44 #include "content/public/browser/render_frame_host.h"
44 #include "content/public/browser/render_process_host.h" 45 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_view_host.h" 46 #include "content/public/browser/render_view_host.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 script_executor_( 83 script_executor_(
83 new ScriptExecutor(web_contents, &script_execution_observers_)), 84 new ScriptExecutor(web_contents, &script_execution_observers_)),
84 location_bar_controller_(new LocationBarController(web_contents)), 85 location_bar_controller_(new LocationBarController(web_contents)),
85 active_script_controller_(new ActiveScriptController(web_contents)), 86 active_script_controller_(new ActiveScriptController(web_contents)),
86 webstore_inline_installer_factory_(new WebstoreInlineInstallerFactory()), 87 webstore_inline_installer_factory_(new WebstoreInlineInstallerFactory()),
87 image_loader_ptr_factory_(this), 88 image_loader_ptr_factory_(this),
88 weak_ptr_factory_(this) { 89 weak_ptr_factory_(this) {
89 // The ActiveTabPermissionManager requires a session ID; ensure this 90 // The ActiveTabPermissionManager requires a session ID; ensure this
90 // WebContents has one. 91 // WebContents has one.
91 SessionTabHelper::CreateForWebContents(web_contents); 92 SessionTabHelper::CreateForWebContents(web_contents);
93
94 sessions::ContentOpenTab::CreateForWebContents(web_contents);
95
92 // The Unretained() is safe because ForEachFrame is synchronous. 96 // The Unretained() is safe because ForEachFrame is synchronous.
93 web_contents->ForEachFrame( 97 web_contents->ForEachFrame(
94 base::Bind(&TabHelper::SetTabId, base::Unretained(this))); 98 base::Bind(&TabHelper::SetTabId, base::Unretained(this)));
95 active_tab_permission_granter_.reset(new ActiveTabPermissionGranter( 99 active_tab_permission_granter_.reset(new ActiveTabPermissionGranter(
96 web_contents, 100 web_contents,
97 SessionTabHelper::IdForTab(web_contents), 101 SessionTabHelper::IdForTab(web_contents),
98 profile_)); 102 profile_));
99 103
100 AddScriptExecutionObserver(ActivityLog::GetInstance(profile_)); 104 AddScriptExecutionObserver(ActivityLog::GetInstance(profile_));
101 105
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 570 }
567 } 571 }
568 572
569 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) { 573 void TabHelper::SetTabId(content::RenderFrameHost* render_frame_host) {
570 render_frame_host->Send( 574 render_frame_host->Send(
571 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(), 575 new ExtensionMsg_SetTabId(render_frame_host->GetRoutingID(),
572 SessionTabHelper::IdForTab(web_contents()))); 576 SessionTabHelper::IdForTab(web_contents())));
573 } 577 }
574 578
575 } // namespace extensions 579 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698