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

Side by Side Diff: chrome/renderer/extensions/automation_internal_custom_bindings.cc

Issue 2903973002: Rich editable text implementation using spannables (Closed)
Patch Set: Make boolean expressions explicit. Created 3 years, 6 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
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 "chrome/renderer/extensions/automation_internal_custom_bindings.h" 5 #include "chrome/renderer/extensions/automation_internal_custom_bindings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str())); 735 result.Set(v8::String::NewFromUtf8(isolate, attr_value.c_str()));
736 }); 736 });
737 RouteNodeIDFunction( 737 RouteNodeIDFunction(
738 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, 738 "GetNameFrom", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
739 TreeCache* cache, ui::AXNode* node) { 739 TreeCache* cache, ui::AXNode* node) {
740 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>( 740 ui::AXNameFrom name_from = static_cast<ui::AXNameFrom>(
741 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM)); 741 node->data().GetIntAttribute(ui::AX_ATTR_NAME_FROM));
742 std::string name_from_str = ui::ToString(name_from); 742 std::string name_from_str = ui::ToString(name_from);
743 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str())); 743 result.Set(v8::String::NewFromUtf8(isolate, name_from_str.c_str()));
744 }); 744 });
745 RouteNodeIDFunction(
746 "GetBold", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
747 TreeCache* cache, ui::AXNode* node) {
748 bool value = (node->data().GetIntAttribute(ui::AX_ATTR_TEXT_STYLE) &
749 ui::AX_TEXT_STYLE_BOLD) != 0;
750 result.Set(v8::Boolean::New(isolate, value));
751 });
752 RouteNodeIDFunction(
753 "GetItalic", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result,
754 TreeCache* cache, ui::AXNode* node) {
755 bool value = (node->data().GetIntAttribute(ui::AX_ATTR_TEXT_STYLE) &
756 ui::AX_TEXT_STYLE_ITALIC) != 0;
757 result.Set(v8::Boolean::New(isolate, value));
758 });
759 RouteNodeIDFunction("GetUnderline", [](v8::Isolate* isolate,
760 v8::ReturnValue<v8::Value> result,
761 TreeCache* cache, ui::AXNode* node) {
762 bool value = (node->data().GetIntAttribute(ui::AX_ATTR_TEXT_STYLE) &
763 ui::AX_TEXT_STYLE_UNDERLINE) != 0;
764 result.Set(v8::Boolean::New(isolate, value));
765 });
766 RouteNodeIDFunction("GetLineThrough", [](v8::Isolate* isolate,
767 v8::ReturnValue<v8::Value> result,
768 TreeCache* cache, ui::AXNode* node) {
769 bool value = (node->data().GetIntAttribute(ui::AX_ATTR_TEXT_STYLE) &
770 ui::AX_TEXT_STYLE_LINE_THROUGH) != 0;
771 result.Set(v8::Boolean::New(isolate, value));
772 });
745 RouteNodeIDFunction("GetChecked", [](v8::Isolate* isolate, 773 RouteNodeIDFunction("GetChecked", [](v8::Isolate* isolate,
746 v8::ReturnValue<v8::Value> result, 774 v8::ReturnValue<v8::Value> result,
747 TreeCache* cache, ui::AXNode* node) { 775 TreeCache* cache, ui::AXNode* node) {
748 const ui::AXCheckedState checked_state = static_cast<ui::AXCheckedState>( 776 const ui::AXCheckedState checked_state = static_cast<ui::AXCheckedState>(
749 node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); 777 node->data().GetIntAttribute(ui::AX_ATTR_CHECKED_STATE));
750 if (checked_state) { 778 if (checked_state) {
751 const std::string checked_str = ui::ToString(checked_state); 779 const std::string checked_str = ui::ToString(checked_state);
752 result.Set(v8::String::NewFromUtf8(isolate, checked_str.c_str())); 780 result.Set(v8::String::NewFromUtf8(isolate, checked_str.c_str()));
753 } 781 }
754 }); 782 });
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 for (auto id : ids) 1467 for (auto id : ids)
1440 nodes->AppendInteger(id); 1468 nodes->AppendInteger(id);
1441 args.Append(std::move(nodes)); 1469 args.Append(std::move(nodes));
1442 } 1470 }
1443 1471
1444 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved", 1472 bindings_system_->DispatchEventInContext("automationInternal.onNodesRemoved",
1445 &args, nullptr, context()); 1473 &args, nullptr, context());
1446 } 1474 }
1447 1475
1448 } // namespace extensions 1476 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/automation.idl ('k') | chrome/renderer/resources/extensions/automation/automation_node.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698