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

Unified Diff: content/shell/shell.cc

Issue 10831056: Port the render_view_host_manager_browsertest.cc to content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/shell.cc
===================================================================
--- content/shell/shell.cc (revision 148713)
+++ content/shell/shell.cc (working copy)
@@ -29,6 +29,7 @@
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 @@
, default_edit_wnd_proc_(0)
#endif
{
Charlie Reis 2012/07/30 16:40:01 This macro makes for an odd indent situation. I'm
jam 2012/07/30 17:03:50 I'm not sure what's recommended in this case. when
- 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 @@
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 @@
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,

Powered by Google App Engine
This is Rietveld 408576698