diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 17:05:18 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-30 17:05:18 +0000 |
commit | 9e00e635121e693b18dc0d5e9b973753febe111d (patch) | |
tree | 90e473e6f206b29aaee9af9bdcd9737a1d012828 /content/shell/shell.cc | |
parent | 39647bb1973a525fc204f127ad573ea0a655d8f6 (diff) | |
download | chromium_src-9e00e635121e693b18dc0d5e9b973753febe111d.zip chromium_src-9e00e635121e693b18dc0d5e9b973753febe111d.tar.gz chromium_src-9e00e635121e693b18dc0d5e9b973753febe111d.tar.bz2 |
Port the render_view_host_manager_browsertest.cc to content_browsertests.
BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10831056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/shell.cc')
-rw-r--r-- | content/shell/shell.cc | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/content/shell/shell.cc b/content/shell/shell.cc index ab0fcd60..a481a68 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -29,6 +29,7 @@ static const int kTestWindowHeight = 600; namespace content { std::vector<Shell*> Shell::windows_; +base::Callback<void(Shell*)> Shell::shell_created_callback_; bool Shell::quit_message_loop_ = true; @@ -39,9 +40,14 @@ Shell::Shell(WebContents* web_contents) , default_edit_wnd_proc_(0) #endif { - registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, - Source<WebContents>(web_contents)); - windows_.push_back(this); + registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, + Source<WebContents>(web_contents)); + windows_.push_back(this); + + if (!shell_created_callback_.is_null()) { + shell_created_callback_.Run(this); + shell_created_callback_.Reset(); + } } Shell::~Shell() { @@ -79,6 +85,12 @@ void Shell::CloseAllWindows() { MessageLoop::current()->RunAllPending(); } +void Shell::SetShellCreatedCallback( + base::Callback<void(Shell*)> shell_created_callback) { + DCHECK(shell_created_callback_.is_null()); + shell_created_callback_ = shell_created_callback; +} + Shell* Shell::FromRenderViewHost(RenderViewHost* rvh) { for (size_t i = 0; i < windows_.size(); ++i) { if (windows_[i]->web_contents() && @@ -145,11 +157,24 @@ gfx::NativeView Shell::GetContentView() { return web_contents_->GetNativeView(); } +WebContents* Shell::OpenURLFromTab(WebContents* source, + const OpenURLParams& params) { + // The only one we implement for now. + DCHECK(params.disposition == CURRENT_TAB); + source->GetController().LoadURL( + params.url, params.referrer, params.transition, std::string()); + return source; +} + void Shell::LoadingStateChanged(WebContents* source) { UpdateNavigationControls(); PlatformSetIsLoading(source->IsLoading()); } +void Shell::CloseContents(WebContents* source) { + Close(); +} + void Shell::WebContentsCreated(WebContents* source_contents, int64 source_frame_id, const GURL& target_url, |