Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/common/devtools/ash_devtools_css_agent.h" | 5 #include "ash/common/devtools/ash_devtools_css_agent.h" |
| 6 | 6 |
| 7 #include "ash/common/wm_window.h" | 7 #include "ash/common/wm_window.h" |
| 8 | 8 |
| 9 namespace ash { | 9 namespace ash { |
| 10 namespace devtools { | 10 namespace devtools { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 AshDevToolsCSSAgent::AshDevToolsCSSAgent(AshDevToolsDOMAgent* dom_agent) | 59 AshDevToolsCSSAgent::AshDevToolsCSSAgent(AshDevToolsDOMAgent* dom_agent) |
| 60 : dom_agent_(dom_agent) { | 60 : dom_agent_(dom_agent) { |
| 61 DCHECK(dom_agent_); | 61 DCHECK(dom_agent_); |
| 62 } | 62 } |
| 63 | 63 |
| 64 AshDevToolsCSSAgent::~AshDevToolsCSSAgent() {} | 64 AshDevToolsCSSAgent::~AshDevToolsCSSAgent() {} |
| 65 | 65 |
| 66 ui::devtools::protocol::Response AshDevToolsCSSAgent::getMatchedStylesForNode( | 66 ui::devtools::protocol::Response AshDevToolsCSSAgent::getMatchedStylesForNode( |
| 67 int nodeId, | 67 int nodeId, |
|
sadrul
2016/11/25 18:30:33
node_id
Sarmad Hashmi
2016/11/26 01:48:20
Done.
| |
| 68 ui::devtools::protocol::Maybe<ui::devtools::protocol::CSS::CSSStyle>* | 68 ui::devtools::protocol::Maybe<ui::devtools::protocol::CSS::CSSStyle>* |
| 69 inlineStyle) { | 69 inlineStyle) { |
| 70 *inlineStyle = GetStylesForNode(nodeId); | 70 *inlineStyle = GetStylesForNode(nodeId); |
| 71 if (!inlineStyle) | |
| 72 return ui::devtools::protocol::Response::Error( | |
| 73 "Node with that id not found"); | |
|
sadrul
2016/11/25 18:30:32
Add {}
Sarmad Hashmi
2016/11/26 01:48:20
Done.
| |
| 71 return ui::devtools::protocol::Response::OK(); | 74 return ui::devtools::protocol::Response::OK(); |
| 72 } | 75 } |
| 73 | 76 |
| 74 std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle> | 77 std::unique_ptr<ui::devtools::protocol::CSS::CSSStyle> |
| 75 AshDevToolsCSSAgent::GetStylesForNode(int nodeId) { | 78 AshDevToolsCSSAgent::GetStylesForNode(int nodeId) { |
|
sadrul
2016/11/25 18:30:32
Whoops: node_id
Sarmad Hashmi
2016/11/26 01:48:20
Done.
| |
| 76 WmWindow* window = dom_agent_->GetWindowFromNodeId(nodeId); | 79 WmWindow* window = dom_agent_->GetWindowFromNodeId(nodeId); |
| 77 if (window) | 80 if (window) |
| 78 return BuildStyles(window); | 81 return BuildStyles(window); |
| 79 | 82 |
| 80 views::Widget* widget = dom_agent_->GetWidgetFromNodeId(nodeId); | 83 views::Widget* widget = dom_agent_->GetWidgetFromNodeId(nodeId); |
| 81 if (widget) | 84 if (widget) |
| 82 return BuildStyles(widget); | 85 return BuildStyles(widget); |
| 83 | 86 |
| 84 views::View* view = dom_agent_->GetViewFromNodeId(nodeId); | 87 views::View* view = dom_agent_->GetViewFromNodeId(nodeId); |
| 85 if (view) | 88 if (view) |
| 86 return BuildStyles(view); | 89 return BuildStyles(view); |
| 87 | 90 |
| 88 NOTREACHED(); | |
| 89 return nullptr; | 91 return nullptr; |
| 90 } | 92 } |
| 91 | 93 |
| 92 } // namespace devtools | 94 } // namespace devtools |
| 93 } // namespace ash | 95 } // namespace ash |
| OLD | NEW |