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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 2460723003: Enable connection to Mojo services from Blink (Closed)
Patch Set: Self-review Created 4 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 30 matching lines...) Expand all
41 #include "content/child/content_child_helpers.h" 41 #include "content/child/content_child_helpers.h"
42 #include "content/child/notifications/notification_dispatcher.h" 42 #include "content/child/notifications/notification_dispatcher.h"
43 #include "content/child/notifications/notification_manager.h" 43 #include "content/child/notifications/notification_manager.h"
44 #include "content/child/push_messaging/push_dispatcher.h" 44 #include "content/child/push_messaging/push_dispatcher.h"
45 #include "content/child/push_messaging/push_provider.h" 45 #include "content/child/push_messaging/push_provider.h"
46 #include "content/child/thread_safe_sender.h" 46 #include "content/child/thread_safe_sender.h"
47 #include "content/child/web_url_loader_impl.h" 47 #include "content/child/web_url_loader_impl.h"
48 #include "content/child/web_url_request_util.h" 48 #include "content/child/web_url_request_util.h"
49 #include "content/child/worker_thread_registry.h" 49 #include "content/child/worker_thread_registry.h"
50 #include "content/public/common/content_client.h" 50 #include "content/public/common/content_client.h"
51 #include "content/public/common/service_manager_connection.h"
51 #include "net/base/net_errors.h" 52 #include "net/base/net_errors.h"
53 #include "services/service_manager/public/cpp/connector.h"
54 #include "services/service_manager/public/interfaces/connector.mojom.h"
52 #include "third_party/WebKit/public/platform/WebData.h" 55 #include "third_party/WebKit/public/platform/WebData.h"
53 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 56 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
54 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 57 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
55 #include "third_party/WebKit/public/platform/WebString.h" 58 #include "third_party/WebKit/public/platform/WebString.h"
56 #include "third_party/WebKit/public/platform/WebURL.h" 59 #include "third_party/WebKit/public/platform/WebURL.h"
57 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h" 60 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_ worker_scheduler.h"
58 #include "ui/base/layout.h" 61 #include "ui/base/layout.h"
59 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" 62 #include "ui/events/gestures/blink/web_gesture_curve_impl.h"
60 #include "ui/events/keycodes/dom/keycode_converter.h" 63 #include "ui/events/keycodes/dom/keycode_converter.h"
61 64
62 using blink::WebData; 65 using blink::WebData;
63 using blink::WebFallbackThemeEngine; 66 using blink::WebFallbackThemeEngine;
64 using blink::WebLocalizedString; 67 using blink::WebLocalizedString;
65 using blink::WebString; 68 using blink::WebString;
66 using blink::WebThemeEngine; 69 using blink::WebThemeEngine;
67 using blink::WebURL; 70 using blink::WebURL;
68 using blink::WebURLError; 71 using blink::WebURLError;
69 using blink::WebURLLoader; 72 using blink::WebURLLoader;
70 using blink::scheduler::WebThreadImplForWorkerScheduler; 73 using blink::scheduler::WebThreadImplForWorkerScheduler;
71 74
72 namespace content { 75 namespace content {
73 76
74 namespace {
75
76
77 } // namespace
78
79 static int ToMessageID(WebLocalizedString::Name name) { 77 static int ToMessageID(WebLocalizedString::Name name) {
80 switch (name) { 78 switch (name) {
81 case WebLocalizedString::AXAMPMFieldText: 79 case WebLocalizedString::AXAMPMFieldText:
82 return IDS_AX_AM_PM_FIELD_TEXT; 80 return IDS_AX_AM_PM_FIELD_TEXT;
83 case WebLocalizedString::AXButtonActionVerb: 81 case WebLocalizedString::AXButtonActionVerb:
84 return IDS_AX_BUTTON_ACTION_VERB; 82 return IDS_AX_BUTTON_ACTION_VERB;
85 case WebLocalizedString::AXCalendarShowMonthSelector: 83 case WebLocalizedString::AXCalendarShowMonthSelector:
86 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR; 84 return IDS_AX_CALENDAR_SHOW_MONTH_SELECTOR;
87 case WebLocalizedString::AXCalendarShowNextMonth: 85 case WebLocalizedString::AXCalendarShowNextMonth:
88 return IDS_AX_CALENDAR_SHOW_NEXT_MONTH; 86 return IDS_AX_CALENDAR_SHOW_NEXT_MONTH;
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 long long BlinkPlatformImpl::databaseGetSpaceAvailableForOrigin( 804 long long BlinkPlatformImpl::databaseGetSpaceAvailableForOrigin(
807 const blink::WebSecurityOrigin& origin) { 805 const blink::WebSecurityOrigin& origin) {
808 return 0; 806 return 0;
809 } 807 }
810 808
811 bool BlinkPlatformImpl::databaseSetFileSize( 809 bool BlinkPlatformImpl::databaseSetFileSize(
812 const blink::WebString& vfs_file_name, long long size) { 810 const blink::WebString& vfs_file_name, long long size) {
813 return false; 811 return false;
814 } 812 }
815 813
814 service_manager::mojom::blink::ConnectorPtr
815 BlinkPlatformImpl::serviceConnector() {
Ken Rockot(use gerrit already) 2016/11/28 20:24:01 nit: maybe it should be called createServiceConnec
blundell 2016/12/15 17:04:51 Done (changed to bindServiceConnector).
816 service_manager::mojom::blink::ConnectorPtr blink_ptr;
817 if (!ChildThreadImpl::current())
818 return blink_ptr;
819
820 service_manager::mojom::ConnectorPtr chromium_ptr;
821 ChildThreadImpl::current()
822 ->GetServiceManagerConnection()
esprehn 2016/12/02 02:23:14 Is there a reason we can't just return the GetServ
blundell 2016/12/05 17:06:02 ServiceManagerConnection is a //content type that
823 ->GetConnector()
824 ->BindRequest(mojo::GetProxy(&chromium_ptr));
825
826 // Pass the pipe from |chromium_ptr| to |blink_ptr|.
827 service_manager::mojom::ConnectorPtrInfo chromium_ptr_info =
828 chromium_ptr.PassInterface();
829 DCHECK(chromium_ptr_info.is_valid());
830 blink_ptr.Bind(service_manager::mojom::blink::ConnectorPtrInfo(
831 chromium_ptr_info.PassHandle(), chromium_ptr_info.version()));
832 DCHECK(blink_ptr.is_bound());
833
834 return blink_ptr;
835 }
836
816 blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString( 837 blink::WebString BlinkPlatformImpl::signedPublicKeyAndChallengeString(
817 unsigned key_size_index, 838 unsigned key_size_index,
818 const blink::WebString& challenge, 839 const blink::WebString& challenge,
819 const blink::WebURL& url, 840 const blink::WebURL& url,
820 const blink::WebURL& top_origin) { 841 const blink::WebURL& top_origin) {
821 return blink::WebString(""); 842 return blink::WebString("");
822 } 843 }
823 844
824 size_t BlinkPlatformImpl::actualMemoryUsageMB() { 845 size_t BlinkPlatformImpl::actualMemoryUsageMB() {
825 return GetMemoryUsageKB() >> 10; 846 return GetMemoryUsageKB() >> 10;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( 895 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString(
875 static_cast<ui::DomKey>(dom_key))); 896 static_cast<ui::DomKey>(dom_key)));
876 } 897 }
877 898
878 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { 899 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
879 return static_cast<int>( 900 return static_cast<int>(
880 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); 901 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
881 } 902 }
882 903
883 } // namespace content 904 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698