OLD | NEW |
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 "components/mus/public/cpp/view.h" | 5 #include "components/mus/public/cpp/view.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 void View::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { | 364 void View::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { |
365 // SetImeVisibility() shouldn't be used if the view is not editable. | 365 // SetImeVisibility() shouldn't be used if the view is not editable. |
366 DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); | 366 DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); |
367 if (connection_) { | 367 if (connection_) { |
368 static_cast<ViewTreeClientImpl*>(connection_) | 368 static_cast<ViewTreeClientImpl*>(connection_) |
369 ->SetImeVisibility(id_, visible, state.Pass()); | 369 ->SetImeVisibility(id_, visible, state.Pass()); |
370 } | 370 } |
371 } | 371 } |
372 | 372 |
| 373 void View::SetCapture() { |
| 374 if (connection_) |
| 375 static_cast<ViewTreeClientImpl*>(connection_)->SetCapture(id_); |
| 376 } |
| 377 |
373 void View::SetFocus() { | 378 void View::SetFocus() { |
374 if (connection_) | 379 if (connection_) |
375 static_cast<ViewTreeClientImpl*>(connection_)->SetFocus(id_); | 380 static_cast<ViewTreeClientImpl*>(connection_)->SetFocus(id_); |
376 } | 381 } |
377 | 382 |
378 bool View::HasFocus() const { | 383 bool View::HasFocus() const { |
379 return connection_ && connection_->GetFocusedView() == this; | 384 return connection_ && connection_->GetFocusedView() == this; |
380 } | 385 } |
381 | 386 |
382 void View::Embed(mojo::ViewTreeClientPtr client) { | 387 void View::Embed(mojo::ViewTreeClientPtr client) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 !static_cast<ViewTreeClientImpl*>(connection_)->is_embed_root()) { | 611 !static_cast<ViewTreeClientImpl*>(connection_)->is_embed_root()) { |
607 return false; | 612 return false; |
608 } | 613 } |
609 | 614 |
610 while (!children_.empty()) | 615 while (!children_.empty()) |
611 RemoveChild(children_[0]); | 616 RemoveChild(children_[0]); |
612 return true; | 617 return true; |
613 } | 618 } |
614 | 619 |
615 } // namespace mus | 620 } // namespace mus |
OLD | NEW |