Commit 3bbacc5b authored by avi@chromium.org's avatar avi@chromium.org

TabContents -> WebContentsImpl, part 19.

BUG=105875
TEST=no change


Review URL: http://codereview.chromium.org/10106022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132599 0039d316-1c4b-4281-b951-d872f2087c98
parent 1dda5abe
......@@ -54,7 +54,7 @@ class BrowserPluginWebContentsObserver: public WebContentsObserver,
virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE;
virtual void WebContentsDestroyed(WebContents* tab) OVERRIDE;
virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
private:
typedef std::map<WebContentsImpl*, int64> GuestMap;
......
......@@ -46,13 +46,13 @@ IN_PROC_BROWSER_TEST_F(ChildProcessSecurityPolicyInProcessBrowserTest, NoLeak) {
ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(),
1U);
WebContents* tab = browser()->GetWebContentsAt(0);
ASSERT_TRUE(tab != NULL);
base::KillProcess(tab->GetRenderProcessHost()->GetHandle(),
WebContents* web_contents = browser()->GetWebContentsAt(0);
ASSERT_TRUE(web_contents != NULL);
base::KillProcess(web_contents->GetRenderProcessHost()->GetHandle(),
content::RESULT_CODE_KILLED, true);
tab->GetController().Reload(true);
web_contents->GetController().Reload(true);
EXPECT_EQ(
ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size(),
1U);
1U,
ChildProcessSecurityPolicyImpl::GetInstance()->security_state_.size());
}
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -56,9 +56,10 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) {
ui_test_utils::NavigateToURL(browser(),
test_server()->GetURL("files/google/google.html"));
WebContents* tab = browser()->GetSelectedWebContents();
tab->GenerateMHTML(path,
base::Bind(&MHTMLGenerationTest::MHTMLGenerated, this));
WebContents* web_contents = browser()->GetSelectedWebContents();
web_contents->GenerateMHTML(path,
base::Bind(&MHTMLGenerationTest::MHTMLGenerated,
this));
// Block until the MHTML is generated.
ui_test_utils::RunMessageLoop();
......
......@@ -123,7 +123,7 @@ void AcceleratedSurfaceBuffersSwappedCompleted(int host_id,
#if defined(TOOLKIT_GTK)
// Used to put a lock on surfaces so that the window to which the GPU
// process is drawing to doesn't disappear while it is drawing when
// a tab is closed.
// a WebContents is closed.
class GpuProcessHost::SurfaceRef {
public:
explicit SurfaceRef(gfx::PluginWindowHandle surface);
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -36,15 +36,15 @@ class CONTENT_EXPORT HostZoomMapImpl
virtual void SetDefaultZoomLevel(double level) OVERRIDE;
// Returns the temporary zoom level that's only valid for the lifetime of
// the given tab (i.e. isn't saved and doesn't affect other tabs) if it
// exists, the default zoom level otherwise.
// the given WebContents (i.e. isn't saved and doesn't affect other
// WebContentses) if it exists, the default zoom level otherwise.
//
// This may be called on any thread.
double GetTemporaryZoomLevel(int render_process_id,
int render_view_id) const;
// Sets the temporary zoom level that's only valid for the lifetime of this
// tab.
// WebContents.
//
// This should only be called on the UI thread.
void SetTemporaryZoomLevel(int render_process_id,
......
......@@ -128,8 +128,8 @@ BackingStore* CreateBackingStore(RenderWidgetHost* host,
if (current_mem + new_mem > max_mem) {
// Need to remove old backing stores to make room for the new one. We
// don't want to do this when the backing store is being replace by a new
// one for the same tab, but this case won't get called then: we'll have
// removed the old one in the RemoveBackingStore above, and the cache
// one for the same WebContents, but this case won't get called then: we'll
// have removed the old one in the RemoveBackingStore above, and the cache
// won't be over-sized.
CreateCacheSpace((current_mem + new_mem) - max_mem);
}
......
......@@ -233,8 +233,8 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BaseURLParam) {
// Test that a hung renderer is killed after navigating away during cross-site
// navigation.
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
WebContents* tab = NULL;
WebContents* tab2 = NULL;
WebContents* web_contents = NULL;
WebContents* web_contents_2 = NULL;
content::RenderProcessHost* rph = NULL;
base::ProcessHandle process;
FilePath doc_root;
......@@ -260,9 +260,9 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
// Navigate the tab to the page which will lock up the process when we
// navigate away from it.
ui_test_utils::NavigateToURL(browser(), infinite_beforeunload_url);
tab = browser()->GetWebContentsAt(0);
rph = tab->GetRenderProcessHost();
EXPECT_EQ(tab->GetURL(), infinite_beforeunload_url);
web_contents = browser()->GetWebContentsAt(0);
rph = web_contents->GetRenderProcessHost();
EXPECT_EQ(web_contents->GetURL(), infinite_beforeunload_url);
// Remember the process prior to navigation, as we expect it to get killed.
process = rph->GetHandle();
......@@ -285,10 +285,10 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
}
ui_test_utils::NavigateToURL(browser(), same_process_url);
tab = browser()->GetWebContentsAt(0);
rph = tab->GetRenderProcessHost();
ASSERT_TRUE(tab != NULL);
EXPECT_EQ(tab->GetURL(), same_process_url);
web_contents = browser()->GetWebContentsAt(0);
rph = web_contents->GetRenderProcessHost();
ASSERT_TRUE(web_contents != NULL);
EXPECT_EQ(web_contents->GetURL(), same_process_url);
// Now, let's open another tab with the unresponsive page, which will cause
// the previous page and the unresponsive one to use the same process.
......@@ -296,10 +296,10 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
infinite_unload_url, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
EXPECT_EQ(browser()->tab_count(), 2);
tab2 = browser()->GetWebContentsAt(1);
ASSERT_TRUE(tab2 != NULL);
EXPECT_EQ(tab2->GetURL(), infinite_unload_url);
EXPECT_EQ(rph, tab2->GetRenderProcessHost());
web_contents_2 = browser()->GetWebContentsAt(1);
ASSERT_TRUE(web_contents_2 != NULL);
EXPECT_EQ(web_contents_2->GetURL(), infinite_unload_url);
EXPECT_EQ(rph, web_contents_2->GetRenderProcessHost());
process = rph->GetHandle();
ASSERT_TRUE(process);
......@@ -320,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveCrossSiteNavigation) {
// Test that a hung renderer is killed when we are closing the page.
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveClosePage) {
WebContents* tab = NULL;
WebContents* web_contents = NULL;
FilePath doc_root;
doc_root = doc_root.Append(FILE_PATH_LITERAL("content"));
......@@ -346,12 +346,12 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveClosePage) {
ui_test_utils::NavigateToURLWithDisposition(browser(),
infinite_beforeunload_url, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
tab = browser()->GetWebContentsAt(1);
web_contents = browser()->GetWebContentsAt(1);
{
ui_test_utils::WindowedNotificationObserver process_exit_observer(
content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllSources());
browser()->CloseTabContents(tab);
browser()->CloseTabContents(web_contents);
process_exit_observer.Wait();
}
......@@ -360,12 +360,12 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, UnresponsiveClosePage) {
ui_test_utils::NavigateToURLWithDisposition(browser(),
infinite_unload_url, NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
tab = browser()->GetWebContentsAt(1);
web_contents = browser()->GetWebContentsAt(1);
{
ui_test_utils::WindowedNotificationObserver process_exit_observer(
content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
content::NotificationService::AllSources());
browser()->CloseTabContents(tab);
browser()->CloseTabContents(web_contents);
process_exit_observer.Wait();
}
}
......@@ -138,11 +138,11 @@ static void InitInterstitialPageMap() {
namespace content {
InterstitialPage* InterstitialPage::Create(WebContents* tab,
InterstitialPage* InterstitialPage::Create(WebContents* web_contents,
bool new_navigation,
const GURL& url,
InterstitialPageDelegate* delegate) {
return new InterstitialPageImpl(tab, new_navigation, url, delegate);
return new InterstitialPageImpl(web_contents, new_navigation, url, delegate);
}
InterstitialPage* InterstitialPage::GetInterstitialPage(
......
......@@ -346,9 +346,9 @@ WebContentsImpl::~WebContentsImpl() {
#endif
// OnCloseStarted isn't called in unit tests.
if (!tab_close_start_time_.is_null()) {
if (!close_start_time_.is_null()) {
UMA_HISTOGRAM_TIMES("Tab.Close",
base::TimeTicks::Now() - tab_close_start_time_);
base::TimeTicks::Now() - close_start_time_);
}
FOR_EACH_OBSERVER(WebContentsObserver,
......@@ -1250,8 +1250,8 @@ base::TimeTicks WebContentsImpl::GetNewTabStartTime() const {
}
void WebContentsImpl::OnCloseStarted() {
if (tab_close_start_time_.is_null())
tab_close_start_time_ = base::TimeTicks::Now();
if (close_start_time_.is_null())
close_start_time_ = base::TimeTicks::Now();
}
bool WebContentsImpl::ShouldAcceptDragAndDrop() const {
......@@ -2584,7 +2584,7 @@ void WebContentsImpl::OnDialogClosed(RenderViewHost* rvh,
// spinning, since we forced it to start spinning in Navigate.
DidStopLoading();
tab_close_start_time_ = base::TimeTicks();
close_start_time_ = base::TimeTicks();
}
is_showing_before_unload_dialog_ = false;
static_cast<RenderViewHostImpl*>(
......
......@@ -660,8 +660,8 @@ class CONTENT_EXPORT WebContentsImpl
// The time that we started to create the new tab page.
base::TimeTicks new_tab_start_time_;
// The time that we started to close the tab.
base::TimeTicks tab_close_start_time_;
// The time that we started to close this WebContents.
base::TimeTicks close_start_time_;
// The time that this tab was last selected.
base::TimeTicks last_selected_time_;
......
......@@ -84,7 +84,7 @@ WebContentsViewGtk::WebContentsViewGtk(
: web_contents_(web_contents),
expanded_(gtk_expanded_container_new()),
delegate_(delegate) {
gtk_widget_set_name(expanded_.get(), "chrome-tab-contents-view");
gtk_widget_set_name(expanded_.get(), "chrome-web-contents-view");
g_signal_connect(expanded_.get(), "size-allocate",
G_CALLBACK(OnSizeAllocateThunk), this);
g_signal_connect(expanded_.get(), "child-size-request",
......
......@@ -17,7 +17,7 @@ class WebContents;
class ColorChooser {
public:
static ColorChooser* Create(int identifier,
WebContents* tab,
WebContents* web_contents,
SkColor initial_color);
ColorChooser(int identifier) : identifier_(identifier) {}
virtual ~ColorChooser() {}
......
......@@ -34,15 +34,15 @@ class WebContents;
class InterstitialPage {
public:
// Creates an interstitial page to show in |tab|. |new_navigation| should be
// set to true when the interstitial is caused by loading a new page, in which
// case a temporary navigation entry is created with the URL |url| and added
// to the navigation controller (so the interstitial page appears as a new
// navigation entry). |new_navigation| should be false when the interstitial
// was triggered by a loading a sub-resource in a page. Takes ownership of
// |delegate|.
// Creates an interstitial page to show in |web_contents|. |new_navigation|
// should be set to true when the interstitial is caused by loading a new
// page, in which case a temporary navigation entry is created with the URL
// |url| and added to the navigation controller (so the interstitial page
// appears as a new navigation entry). |new_navigation| should be false when
// the interstitial was triggered by a loading a sub-resource in a page. Takes
// ownership of |delegate|.
CONTENT_EXPORT static InterstitialPage* Create(
WebContents* tab,
WebContents* web_contents,
bool new_navigation,
const GURL& url,
InterstitialPageDelegate* delegate);
......
......@@ -50,7 +50,7 @@ struct RendererPreferences;
// Describes what goes in the main content area of a tab.
class WebContents : public PageNavigator {
public:
// |base_tab_contents| is used if we want to size the new WebContents's view
// |base_web_contents| is used if we want to size the new WebContents's view
// based on the view of an existing WebContents. This can be NULL if not
// needed.
//
......
......@@ -44,7 +44,7 @@ bool WebContentsDelegate::ShouldSuppressDialogs() {
return false;
}
void WebContentsDelegate::BeforeUnloadFired(WebContents* tab,
void WebContentsDelegate::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
*proceed_to_fire_unload = true;
......@@ -134,18 +134,19 @@ JavaScriptDialogCreator* WebContentsDelegate::GetJavaScriptDialogCreator() {
}
bool WebContentsDelegate::IsFullscreenForTabOrPending(
const WebContents* tab) const {
const WebContents* web_contents) const {
return false;
}
content::ColorChooser* WebContentsDelegate::OpenColorChooser(WebContents* tab,
content::ColorChooser* WebContentsDelegate::OpenColorChooser(
WebContents* web_contents,
int color_chooser_id,
const SkColor& color) {
return NULL;
}
void WebContentsDelegate::WebIntentDispatch(
WebContents* tab,
WebContents* web_contents,
WebIntentsDispatcher* intents_dispatcher) {
// The caller passes this method ownership of the |intents_dispatcher|, but
// this empty implementation will not use it, so we delete it immediately.
......
......@@ -307,51 +307,52 @@ class CONTENT_EXPORT WebContentsDelegate {
virtual void WorkerCrashed(WebContents* source) {}
// Invoked when a main fram navigation occurs.
virtual void DidNavigateMainFramePostCommit(WebContents* tab) {}
virtual void DidNavigateMainFramePostCommit(WebContents* source) {}
// Invoked when navigating to a pending entry. When invoked the
// NavigationController has configured its pending entry, but it has not yet
// been committed.
virtual void DidNavigateToPendingEntry(WebContents* tab) {}
virtual void DidNavigateToPendingEntry(WebContents* source) {}
// Returns a pointer to a service to create JavaScript dialogs. May return
// NULL in which case dialogs aren't shown.
virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator();
// Called when color chooser should open. Returns the opened color chooser.
virtual content::ColorChooser* OpenColorChooser(WebContents* tab,
virtual content::ColorChooser* OpenColorChooser(WebContents* web_contents,
int color_chooser_id,
const SkColor& color);
virtual void DidEndColorChooser() {}
// Called when a file selection is to be done.
virtual void RunFileChooser(WebContents* tab,
virtual void RunFileChooser(WebContents* web_contents,
const FileChooserParams& params) {}
// Request to enumerate a directory. This is equivalent to running the file
// chooser in directory-enumeration mode and having the user select the given
// directory.
virtual void EnumerateDirectory(WebContents* tab,
virtual void EnumerateDirectory(WebContents* web_contents,
int request_id,
const FilePath& path) {}
// Called when the renderer puts a tab into or out of fullscreen mode.
virtual void ToggleFullscreenModeForTab(WebContents* tab,
virtual void ToggleFullscreenModeForTab(WebContents* web_contents,
bool enter_fullscreen) {}
virtual bool IsFullscreenForTabOrPending(const WebContents* tab) const;
virtual bool IsFullscreenForTabOrPending(
const WebContents* web_contents) const;
// Called when a Javascript out of memory notification is received.
virtual void JSOutOfMemory(WebContents* tab) {}
virtual void JSOutOfMemory(WebContents* web_contents) {}
// Register a new handler for URL requests with the given scheme.
virtual void RegisterProtocolHandler(WebContents* tab,
virtual void RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol,
const GURL& url,
const string16& title) {}
// Register a new handler for Intents with the given action and type filter.
virtual void RegisterIntentHandler(WebContents* tab,
virtual void RegisterIntentHandler(WebContents* web_contents,
const string16& action,
const string16& type,
const string16& href,
......@@ -360,13 +361,13 @@ class CONTENT_EXPORT WebContentsDelegate {
// Web Intents notification handler. See WebIntentsDispatcher for
// documentation of callee responsibility for the dispatcher.
virtual void WebIntentDispatch(WebContents* tab,
virtual void WebIntentDispatch(WebContents* web_contents,
WebIntentsDispatcher* intents_dispatcher);
// Result of string search in the page. This includes the number of matches
// found and the selection rect (in screen coordinates) for the string found.
// If |final_update| is false, it indicates that more results follow.
virtual void FindReply(WebContents* tab,
virtual void FindReply(WebContents* web_contents,
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
......@@ -374,7 +375,8 @@ class CONTENT_EXPORT WebContentsDelegate {
bool final_update) {}
// Notification that a plugin has crashed.
virtual void CrashedPlugin(WebContents* tab, const FilePath& plugin_path) {}
virtual void CrashedPlugin(WebContents* web_contents,
const FilePath& plugin_path) {}
// Notication that the given plugin has hung or become unhung. This
// notification is only for Pepper plugins.
......@@ -382,21 +384,21 @@ class CONTENT_EXPORT WebContentsDelegate {
// The plugin_child_id is the unique child process ID from the plugin. Note
// that this ID is supplied by the renderer, so should be validated before
// it's used for anything in case there's an exploited renderer.
virtual void PluginHungStatusChanged(WebContents* tab,
virtual void PluginHungStatusChanged(WebContents* web_contents,
int plugin_child_id,
const FilePath& plugin_path,
bool is_hung) {}
// Invoked when the preferred size of the contents has been changed.
virtual void UpdatePreferredSize(WebContents* tab,
virtual void UpdatePreferredSize(WebContents* web_contents,
const gfx::Size& pref_size) {}
// Invoked when the contents auto-resized and the container should match it.
virtual void ResizeDueToAutoResize(WebContents* tab,
virtual void ResizeDueToAutoResize(WebContents* web_contents,
const gfx::Size& new_size) {}
// Notification message from HTML UI.
virtual void WebUISend(WebContents* tab,
virtual void WebUISend(WebContents* web_contents,
const GURL& source_url,
const std::string& name,
const base::ListValue& args) {}
......@@ -404,7 +406,7 @@ class CONTENT_EXPORT WebContentsDelegate {
// Requests to lock the mouse. Once the request is approved or rejected,
// GotResponseToLockMouseRequest() will be called on the requesting tab
// contents.
virtual void RequestToLockMouse(WebContents* tab) {}
virtual void RequestToLockMouse(WebContents* web_contents) {}
// Notification that the page has lost the mouse lock.
virtual void LostMouseLock() {}
......
......@@ -152,8 +152,8 @@ void Shell::WebContentsCreated(WebContents* source_contents,
CreateShell(new_contents);
}
void Shell::DidNavigateMainFramePostCommit(WebContents* tab) {
PlatformSetAddressBarURL(tab->GetURL());
void Shell::DidNavigateMainFramePostCommit(WebContents* web_contents) {
PlatformSetAddressBarURL(web_contents->GetURL());
}
JavaScriptDialogCreator* Shell::GetJavaScriptDialogCreator() {
......
......@@ -120,7 +120,8 @@ class Shell : public WebContentsDelegate,
int64 source_frame_id,
const GURL& target_url,
WebContents* new_contents) OVERRIDE;
virtual void DidNavigateMainFramePostCommit(WebContents* tab) OVERRIDE;
virtual void DidNavigateMainFramePostCommit(
WebContents* web_contents) OVERRIDE;
virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator() OVERRIDE;
#if defined(OS_MACOSX)
virtual void HandleKeyboardEvent(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment