diff options
Diffstat (limited to 'content/shell/shell.cc')
-rw-r--r-- | content/shell/shell.cc | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/content/shell/shell.cc b/content/shell/shell.cc index c2d5329..49097bc 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -8,9 +8,9 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/string_util.h" -#include "content/browser/renderer_host/render_view_host_impl.h" -#include "content/browser/tab_contents/navigation_controller_impl.h" -#include "content/browser/tab_contents/tab_contents.h" +#include "content/public/browser/navigation_controller.h" +#include "content/public/browser/render_view_host.h" +#include "content/public/browser/web_contents.h" #include "content/shell/shell_messages.h" #include "content/shell/shell_switches.h" #include "ui/gfx/size.h" @@ -23,8 +23,8 @@ namespace content { std::vector<Shell*> Shell::windows_; -Shell::Shell(TabContents* tab_contents) - : WebContentsObserver(tab_contents), +Shell::Shell(WebContents* web_contents) + : WebContentsObserver(web_contents), wait_until_done_(false), window_(NULL), url_edit_view_(NULL) @@ -46,12 +46,12 @@ Shell::~Shell() { } } -Shell* Shell::CreateShell(TabContents* tab_contents) { - Shell* shell = new Shell(tab_contents); +Shell* Shell::CreateShell(WebContents* web_contents) { + Shell* shell = new Shell(web_contents); shell->PlatformCreateWindow(kTestWindowWidth, kTestWindowHeight); - shell->tab_contents_.reset(tab_contents); - tab_contents->SetDelegate(shell); + shell->web_contents_.reset(web_contents); + web_contents->SetDelegate(shell); shell->PlatformSetContents(); @@ -61,8 +61,8 @@ Shell* Shell::CreateShell(TabContents* tab_contents) { Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) { for (size_t i = 0; i < windows_.size(); ++i) { - if (windows_[i]->tab_contents() && - windows_[i]->tab_contents()->GetRenderViewHost() == rvh) { + if (windows_[i]->web_contents() && + windows_[i]->web_contents()->GetRenderViewHost() == rvh) { return windows_[i]; } } @@ -73,56 +73,56 @@ Shell* Shell::CreateNewWindow(content::BrowserContext* browser_context, const GURL& url, SiteInstance* site_instance, int routing_id, - TabContents* base_tab_contents) { - TabContents* tab_contents = new TabContents( + WebContents* base_web_contents) { + WebContents* web_contents = WebContents::Create( browser_context, site_instance, routing_id, - base_tab_contents, + base_web_contents, NULL); - Shell* shell = CreateShell(tab_contents); + Shell* shell = CreateShell(web_contents); if (!url.is_empty()) shell->LoadURL(url); return shell; } void Shell::LoadURL(const GURL& url) { - tab_contents_->GetController().LoadURL( + web_contents_->GetController().LoadURL( url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - tab_contents_->Focus(); + web_contents_->Focus(); } void Shell::GoBackOrForward(int offset) { - tab_contents_->GetController().GoToOffset(offset); - tab_contents_->Focus(); + web_contents_->GetController().GoToOffset(offset); + web_contents_->Focus(); } void Shell::Reload() { - tab_contents_->GetController().Reload(false); - tab_contents_->Focus(); + web_contents_->GetController().Reload(false); + web_contents_->Focus(); } void Shell::Stop() { - tab_contents_->Stop(); - tab_contents_->Focus(); + web_contents_->Stop(); + web_contents_->Focus(); } void Shell::UpdateNavigationControls() { - int current_index = tab_contents_->GetController().GetCurrentEntryIndex(); - int max_index = tab_contents_->GetController().GetEntryCount() - 1; + int current_index = web_contents_->GetController().GetCurrentEntryIndex(); + int max_index = web_contents_->GetController().GetEntryCount() - 1; PlatformEnableUIControl(BACK_BUTTON, current_index > 0); PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); - PlatformEnableUIControl(STOP_BUTTON, tab_contents_->IsLoading()); + PlatformEnableUIControl(STOP_BUTTON, web_contents_->IsLoading()); } gfx::NativeView Shell::GetContentView() { - if (!tab_contents_.get()) + if (!web_contents_.get()) return NULL; - return tab_contents_->GetNativeView(); + return web_contents_->GetNativeView(); } void Shell::LoadingStateChanged(WebContents* source) { @@ -134,7 +134,7 @@ void Shell::WebContentsCreated(WebContents* source_contents, int64 source_frame_id, const GURL& target_url, WebContents* new_contents) { - CreateShell(static_cast<TabContents*>(new_contents)); + CreateShell(new_contents); } void Shell::DidNavigateMainFramePostCommit(WebContents* tab) { @@ -148,8 +148,7 @@ void Shell::DidFinishLoad(int64 frame_id, return; if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) return; - RenderViewHostImpl* render_view_host = - static_cast<RenderViewHostImpl*>(tab_contents_->GetRenderViewHost()); + RenderViewHost* render_view_host = web_contents_->GetRenderViewHost(); render_view_host->Send( new ShellViewMsg_CaptureTextDump(render_view_host->GetRoutingID(), false)); |