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

Side by Side Diff: apps/app_window_contents.cc

Issue 23847004: "Redirecting URLs to Packaged Apps" implementation: revised (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "apps/app_window_contents.h" 5 #include "apps/app_window_contents.h"
6 6
7 #include "apps/native_app_window.h" 7 #include "apps/native_app_window.h"
8 #include "apps/url_redirector.h"
8 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/common/extensions/api/app_window.h" 11 #include "chrome/common/extensions/api/app_window.h"
11 #include "chrome/common/extensions/extension_messages.h" 12 #include "chrome/common/extensions/extension_messages.h"
12 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
13 #include "content/public/browser/render_process_host.h" 14 #include "content/public/browser/render_process_host.h"
14 #include "content/public/browser/render_view_host.h" 15 #include "content/public/browser/render_view_host.h"
15 #include "content/public/browser/resource_dispatcher_host.h" 16 #include "content/public/browser/resource_dispatcher_host.h"
16 #include "content/public/browser/site_instance.h" 17 #include "content/public/browser/site_instance.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 131 }
131 default: 132 default:
132 NOTREACHED() << "Received unexpected notification"; 133 NOTREACHED() << "Received unexpected notification";
133 } 134 }
134 } 135 }
135 136
136 bool AppWindowContents::OnMessageReceived(const IPC::Message& message) { 137 bool AppWindowContents::OnMessageReceived(const IPC::Message& message) {
137 bool handled = true; 138 bool handled = true;
138 IPC_BEGIN_MESSAGE_MAP(AppWindowContents, message) 139 IPC_BEGIN_MESSAGE_MAP(AppWindowContents, message)
139 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 140 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
141 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RedirectUrl,
142 LaunchAppWithUrl)
140 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions, 143 IPC_MESSAGE_HANDLER(ExtensionHostMsg_UpdateDraggableRegions,
141 UpdateDraggableRegions) 144 UpdateDraggableRegions)
142 IPC_MESSAGE_UNHANDLED(handled = false) 145 IPC_MESSAGE_UNHANDLED(handled = false)
143 IPC_END_MESSAGE_MAP() 146 IPC_END_MESSAGE_MAP()
144 return handled; 147 return handled;
145 } 148 }
146 149
147 extensions::WindowController* 150 extensions::WindowController*
148 AppWindowContents::GetExtensionWindowController() const { 151 AppWindowContents::GetExtensionWindowController() const {
149 return NULL; 152 return NULL;
150 } 153 }
151 154
152 content::WebContents* AppWindowContents::GetAssociatedWebContents() const { 155 content::WebContents* AppWindowContents::GetAssociatedWebContents() const {
153 return web_contents_.get(); 156 return web_contents_.get();
154 } 157 }
155 158
156 void AppWindowContents::OnRequest( 159 void AppWindowContents::OnRequest(
157 const ExtensionHostMsg_Request_Params& params) { 160 const ExtensionHostMsg_Request_Params& params) {
158 extension_function_dispatcher_->Dispatch( 161 extension_function_dispatcher_->Dispatch(
159 params, web_contents_->GetRenderViewHost()); 162 params, web_contents_->GetRenderViewHost());
160 } 163 }
161 164
162 void AppWindowContents::UpdateDraggableRegions( 165 void AppWindowContents::UpdateDraggableRegions(
163 const std::vector<extensions::DraggableRegion>& regions) { 166 const std::vector<extensions::DraggableRegion>& regions) {
164 host_->UpdateDraggableRegions(regions); 167 host_->UpdateDraggableRegions(regions);
165 } 168 }
166 169
170 void AppWindowContents::LaunchAppWithUrl(const GURL& url,
171 const GURL& referrer_url) const {
172 UrlRedirector::MaybeLaunchAppWithUrl(
benwells 2013/09/03 01:10:56 Can you just create a UrlRedirector tab helper thi
sergeygs 2013/09/03 06:15:24 Great advice, thanks, I just didn't find that on m
173 Profile::FromBrowserContext(web_contents_->GetBrowserContext()),
174 url, referrer_url);
175 }
176
167 void AppWindowContents::SuspendRenderViewHost( 177 void AppWindowContents::SuspendRenderViewHost(
168 content::RenderViewHost* rvh) { 178 content::RenderViewHost* rvh) {
169 DCHECK(rvh); 179 DCHECK(rvh);
170 content::BrowserThread::PostTask( 180 content::BrowserThread::PostTask(
171 content::BrowserThread::IO, FROM_HERE, 181 content::BrowserThread::IO, FROM_HERE,
172 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, 182 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute,
173 base::Unretained(content::ResourceDispatcherHost::Get()), 183 base::Unretained(content::ResourceDispatcherHost::Get()),
174 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); 184 rvh->GetProcess()->GetID(), rvh->GetRoutingID()));
175 } 185 }
176 186
177 } // namespace apps 187 } // namespace apps
OLDNEW
« no previous file with comments | « apps/app_window_contents.h ('k') | apps/apps.gypi » ('j') | apps/url_redirector.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698