| OLD | NEW |
| 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 <string> |
| 7 #include <utility> | 8 #include <utility> |
| 8 #include <string> | |
| 9 | 9 |
| 10 #include "apps/ui/native_app_window.h" | |
| 11 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/common/extensions/api/app_window.h" | 11 #include "chrome/common/extensions/api/app_window.h" |
| 13 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
| 14 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 16 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 17 #include "content/public/browser/resource_dispatcher_host.h" | 16 #include "content/public/browser/resource_dispatcher_host.h" |
| 18 #include "content/public/browser/site_instance.h" | 17 #include "content/public/browser/site_instance.h" |
| 19 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/common/renderer_preferences.h" | 19 #include "content/public/common/renderer_preferences.h" |
| 20 #include "extensions/browser/app_window/native_app_window.h" |
| 21 #include "extensions/common/extension_messages.h" | 21 #include "extensions/common/extension_messages.h" |
| 22 | 22 |
| 23 namespace app_window = extensions::api::app_window; | 23 namespace app_window = extensions::api::app_window; |
| 24 | 24 |
| 25 namespace apps { | 25 namespace apps { |
| 26 | 26 |
| 27 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) : host_(host) {} | 27 AppWindowContentsImpl::AppWindowContentsImpl(AppWindow* host) : host_(host) {} |
| 28 | 28 |
| 29 AppWindowContentsImpl::~AppWindowContentsImpl() {} | 29 AppWindowContentsImpl::~AppWindowContentsImpl() {} |
| 30 | 30 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 58 << web_contents_->GetRenderViewHost()->GetProcess()->GetID() | 58 << web_contents_->GetRenderViewHost()->GetProcess()->GetID() |
| 59 << ") != creator (" << creator_process_id << "). Routing disabled."; | 59 << ") != creator (" << creator_process_id << "). Routing disabled."; |
| 60 } | 60 } |
| 61 | 61 |
| 62 web_contents_->GetController().LoadURL( | 62 web_contents_->GetController().LoadURL( |
| 63 url_, content::Referrer(), content::PAGE_TRANSITION_LINK, | 63 url_, content::Referrer(), content::PAGE_TRANSITION_LINK, |
| 64 std::string()); | 64 std::string()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void AppWindowContentsImpl::NativeWindowChanged( | 67 void AppWindowContentsImpl::NativeWindowChanged( |
| 68 NativeAppWindow* native_app_window) { | 68 extensions::NativeAppWindow* native_app_window) { |
| 69 base::ListValue args; | 69 base::ListValue args; |
| 70 base::DictionaryValue* dictionary = new base::DictionaryValue(); | 70 base::DictionaryValue* dictionary = new base::DictionaryValue(); |
| 71 args.Append(dictionary); | 71 args.Append(dictionary); |
| 72 host_->GetSerializedState(dictionary); | 72 host_->GetSerializedState(dictionary); |
| 73 | 73 |
| 74 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); | 74 content::RenderViewHost* rvh = web_contents_->GetRenderViewHost(); |
| 75 rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(), | 75 rvh->Send(new ExtensionMsg_MessageInvoke(rvh->GetRoutingID(), |
| 76 host_->extension_id(), | 76 host_->extension_id(), |
| 77 "app.window", | 77 "app.window", |
| 78 "updateAppWindowProperties", | 78 "updateAppWindowProperties", |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 content::RenderViewHost* rvh) { | 135 content::RenderViewHost* rvh) { |
| 136 DCHECK(rvh); | 136 DCHECK(rvh); |
| 137 content::BrowserThread::PostTask( | 137 content::BrowserThread::PostTask( |
| 138 content::BrowserThread::IO, FROM_HERE, | 138 content::BrowserThread::IO, FROM_HERE, |
| 139 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, | 139 base::Bind(&content::ResourceDispatcherHost::BlockRequestsForRoute, |
| 140 base::Unretained(content::ResourceDispatcherHost::Get()), | 140 base::Unretained(content::ResourceDispatcherHost::Get()), |
| 141 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); | 141 rvh->GetProcess()->GetID(), rvh->GetRoutingID())); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace apps | 144 } // namespace apps |
| OLD | NEW |