OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/views/mus/native_widget_mus.h" | 5 #include "ui/views/mus/native_widget_mus.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 | 492 |
493 DISALLOW_COPY_AND_ASSIGN(MusCaptureClient); | 493 DISALLOW_COPY_AND_ASSIGN(MusCaptureClient); |
494 }; | 494 }; |
495 | 495 |
496 //////////////////////////////////////////////////////////////////////////////// | 496 //////////////////////////////////////////////////////////////////////////////// |
497 // NativeWidgetMus, public: | 497 // NativeWidgetMus, public: |
498 | 498 |
499 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, | 499 NativeWidgetMus::NativeWidgetMus(internal::NativeWidgetDelegate* delegate, |
500 shell::Connector* connector, | 500 shell::Connector* connector, |
501 ui::Window* window, | 501 ui::Window* window, |
502 ui::mojom::SurfaceType surface_type) | 502 ui::mojom::SurfaceType surface_type, |
503 bool accept_events) | |
503 : window_(window), | 504 : window_(window), |
504 last_cursor_(ui::mojom::Cursor::CURSOR_NULL), | 505 last_cursor_(ui::mojom::Cursor::CURSOR_NULL), |
505 native_widget_delegate_(delegate), | 506 native_widget_delegate_(delegate), |
506 surface_type_(surface_type), | 507 surface_type_(surface_type), |
507 show_state_before_fullscreen_(ui::mojom::ShowState::DEFAULT), | 508 show_state_before_fullscreen_(ui::mojom::ShowState::DEFAULT), |
508 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), | 509 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), |
509 content_(new aura::Window(this)), | 510 content_(new aura::Window(this)), |
510 close_widget_factory_(this) { | 511 close_widget_factory_(this) { |
511 window_->set_input_event_handler(this); | 512 window_->set_input_event_handler(this); |
512 mus_window_observer_.reset(new MusWindowObserver(this)); | 513 mus_window_observer_.reset(new MusWindowObserver(this)); |
(...skipping 23 matching lines...) Expand all Loading... | |
536 if (needs_bitmap_uploader) { | 537 if (needs_bitmap_uploader) { |
537 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); | 538 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(window)); |
538 bitmap_uploader_->Init(connector); | 539 bitmap_uploader_->Init(connector); |
539 prop_.reset( | 540 prop_.reset( |
540 new ui::ViewProp(window_tree_host_->GetAcceleratedWidget(), | 541 new ui::ViewProp(window_tree_host_->GetAcceleratedWidget(), |
541 bitmap_uploader::kBitmapUploaderForAcceleratedWidget, | 542 bitmap_uploader::kBitmapUploaderForAcceleratedWidget, |
542 bitmap_uploader_.get())); | 543 bitmap_uploader_.get())); |
543 } | 544 } |
544 | 545 |
545 aura::Env::GetInstance()->set_context_factory(default_context_factory); | 546 aura::Env::GetInstance()->set_context_factory(default_context_factory); |
547 | |
548 if (accept_events == false) window_->SetAcceptEvents(false); | |
sky
2016/07/06 16:21:25
nit: in general we don't use single line condition
riajiang
2016/07/08 17:59:59
Done.
| |
546 } | 549 } |
547 | 550 |
548 NativeWidgetMus::~NativeWidgetMus() { | 551 NativeWidgetMus::~NativeWidgetMus() { |
549 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { | 552 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { |
550 DCHECK(!window_); | 553 DCHECK(!window_); |
551 delete native_widget_delegate_; | 554 delete native_widget_delegate_; |
552 } else { | 555 } else { |
553 if (window_) | 556 if (window_) |
554 window_->set_input_event_handler(nullptr); | 557 window_->set_input_event_handler(nullptr); |
555 CloseNow(); | 558 CloseNow(); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1401 | 1404 |
1402 gfx::Path mask_path; | 1405 gfx::Path mask_path; |
1403 native_widget_delegate_->GetHitTestMask(&mask_path); | 1406 native_widget_delegate_->GetHitTestMask(&mask_path); |
1404 // TODO(jamescook): Use the full path for the mask. | 1407 // TODO(jamescook): Use the full path for the mask. |
1405 gfx::Rect mask_rect = | 1408 gfx::Rect mask_rect = |
1406 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); | 1409 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); |
1407 window_->SetHitTestMask(mask_rect); | 1410 window_->SetHitTestMask(mask_rect); |
1408 } | 1411 } |
1409 | 1412 |
1410 } // namespace views | 1413 } // namespace views |
OLD | NEW |