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, |