OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/browser/aw_content_browser_client.h" | 5 #include "android_webview/browser/aw_content_browser_client.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_browser_main_parts.h" | 8 #include "android_webview/browser/aw_browser_main_parts.h" |
9 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 9 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
10 #include "android_webview/browser/aw_contents_io_thread_client.h" | 10 #include "android_webview/browser/aw_contents_io_thread_client.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // renderer process on the IPC thread. | 45 // renderer process on the IPC thread. |
46 class AwContentsMessageFilter : public content::BrowserMessageFilter { | 46 class AwContentsMessageFilter : public content::BrowserMessageFilter { |
47 public: | 47 public: |
48 explicit AwContentsMessageFilter(int process_id); | 48 explicit AwContentsMessageFilter(int process_id); |
49 | 49 |
50 // BrowserMessageFilter methods. | 50 // BrowserMessageFilter methods. |
51 virtual void OverrideThreadForMessage( | 51 virtual void OverrideThreadForMessage( |
52 const IPC::Message& message, | 52 const IPC::Message& message, |
53 BrowserThread::ID* thread) OVERRIDE; | 53 BrowserThread::ID* thread) OVERRIDE; |
54 virtual bool OnMessageReceived( | 54 virtual bool OnMessageReceived( |
55 const IPC::Message& message, | 55 const IPC::Message& message) OVERRIDE; |
56 bool* message_was_ok) OVERRIDE; | |
57 | 56 |
58 void OnShouldOverrideUrlLoading(int routing_id, | 57 void OnShouldOverrideUrlLoading(int routing_id, |
59 const base::string16& url, | 58 const base::string16& url, |
60 bool* ignore_navigation); | 59 bool* ignore_navigation); |
61 void OnSubFrameCreated(int parent_render_frame_id, int child_render_frame_id); | 60 void OnSubFrameCreated(int parent_render_frame_id, int child_render_frame_id); |
62 | 61 |
63 private: | 62 private: |
64 virtual ~AwContentsMessageFilter(); | 63 virtual ~AwContentsMessageFilter(); |
65 | 64 |
66 int process_id_; | 65 int process_id_; |
67 | 66 |
68 DISALLOW_COPY_AND_ASSIGN(AwContentsMessageFilter); | 67 DISALLOW_COPY_AND_ASSIGN(AwContentsMessageFilter); |
69 }; | 68 }; |
70 | 69 |
71 AwContentsMessageFilter::AwContentsMessageFilter(int process_id) | 70 AwContentsMessageFilter::AwContentsMessageFilter(int process_id) |
72 : BrowserMessageFilter(AndroidWebViewMsgStart), | 71 : BrowserMessageFilter(AndroidWebViewMsgStart), |
73 process_id_(process_id) { | 72 process_id_(process_id) { |
74 } | 73 } |
75 | 74 |
76 AwContentsMessageFilter::~AwContentsMessageFilter() { | 75 AwContentsMessageFilter::~AwContentsMessageFilter() { |
77 } | 76 } |
78 | 77 |
79 void AwContentsMessageFilter::OverrideThreadForMessage( | 78 void AwContentsMessageFilter::OverrideThreadForMessage( |
80 const IPC::Message& message, BrowserThread::ID* thread) { | 79 const IPC::Message& message, BrowserThread::ID* thread) { |
81 if (message.type() == AwViewHostMsg_ShouldOverrideUrlLoading::ID) { | 80 if (message.type() == AwViewHostMsg_ShouldOverrideUrlLoading::ID) { |
82 *thread = BrowserThread::UI; | 81 *thread = BrowserThread::UI; |
83 } | 82 } |
84 } | 83 } |
85 | 84 |
86 bool AwContentsMessageFilter::OnMessageReceived(const IPC::Message& message, | 85 bool AwContentsMessageFilter::OnMessageReceived(const IPC::Message& message) { |
87 bool* message_was_ok) { | |
88 bool handled = true; | 86 bool handled = true; |
89 IPC_BEGIN_MESSAGE_MAP_EX(AwContentsMessageFilter, message, *message_was_ok) | 87 IPC_BEGIN_MESSAGE_MAP(AwContentsMessageFilter, message) |
90 IPC_MESSAGE_HANDLER(AwViewHostMsg_ShouldOverrideUrlLoading, | 88 IPC_MESSAGE_HANDLER(AwViewHostMsg_ShouldOverrideUrlLoading, |
91 OnShouldOverrideUrlLoading) | 89 OnShouldOverrideUrlLoading) |
92 IPC_MESSAGE_HANDLER(AwViewHostMsg_SubFrameCreated, OnSubFrameCreated) | 90 IPC_MESSAGE_HANDLER(AwViewHostMsg_SubFrameCreated, OnSubFrameCreated) |
93 IPC_MESSAGE_UNHANDLED(handled = false) | 91 IPC_MESSAGE_UNHANDLED(handled = false) |
94 IPC_END_MESSAGE_MAP() | 92 IPC_END_MESSAGE_MAP() |
95 return handled; | 93 return handled; |
96 } | 94 } |
97 | 95 |
98 void AwContentsMessageFilter::OnShouldOverrideUrlLoading( | 96 void AwContentsMessageFilter::OnShouldOverrideUrlLoading( |
99 int render_frame_id, | 97 int render_frame_id, |
100 const base::string16& url, | 98 const base::string16& url, |
101 bool* ignore_navigation) { | 99 bool* ignore_navigation) { |
102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
103 *ignore_navigation = false; | 101 *ignore_navigation = false; |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 499 |
502 #if defined(VIDEO_HOLE) | 500 #if defined(VIDEO_HOLE) |
503 content::ExternalVideoSurfaceContainer* | 501 content::ExternalVideoSurfaceContainer* |
504 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( | 502 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( |
505 content::WebContents* web_contents) { | 503 content::WebContents* web_contents) { |
506 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); | 504 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); |
507 } | 505 } |
508 #endif | 506 #endif |
509 | 507 |
510 } // namespace android_webview | 508 } // namespace android_webview |
OLD | NEW |