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

Side by Side Diff: ui/views/mus/native_widget_mus.cc

Issue 2010083002: views/mus: Run some more tests from views_unittests in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/unittests_manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "components/bitmap_uploader/bitmap_uploader.h" 11 #include "components/bitmap_uploader/bitmap_uploader.h"
12 #include "components/mus/public/cpp/property_type_converters.h" 12 #include "components/mus/public/cpp/property_type_converters.h"
13 #include "components/mus/public/cpp/window.h" 13 #include "components/mus/public/cpp/window.h"
14 #include "components/mus/public/cpp/window_observer.h" 14 #include "components/mus/public/cpp/window_observer.h"
15 #include "components/mus/public/cpp/window_property.h" 15 #include "components/mus/public/cpp/window_property.h"
16 #include "components/mus/public/cpp/window_tree_client.h" 16 #include "components/mus/public/cpp/window_tree_client.h"
17 #include "components/mus/public/interfaces/cursor.mojom.h" 17 #include "components/mus/public/interfaces/cursor.mojom.h"
18 #include "components/mus/public/interfaces/window_manager.mojom.h" 18 #include "components/mus/public/interfaces/window_manager.mojom.h"
19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h" 19 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
20 #include "components/mus/public/interfaces/window_tree.mojom.h" 20 #include "components/mus/public/interfaces/window_tree.mojom.h"
21 #include "ui/aura/client/default_capture_client.h" 21 #include "ui/aura/client/default_capture_client.h"
22 #include "ui/aura/client/window_tree_client.h" 22 #include "ui/aura/client/window_tree_client.h"
23 #include "ui/aura/env.h" 23 #include "ui/aura/env.h"
24 #include "ui/aura/layout_manager.h" 24 #include "ui/aura/layout_manager.h"
25 #include "ui/aura/mus/mus_util.h" 25 #include "ui/aura/mus/mus_util.h"
26 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
27 #include "ui/aura/window_property.h" 27 #include "ui/aura/window_property.h"
28 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
29 #include "ui/base/view_prop.h" 29 #include "ui/base/view_prop.h"
30 #include "ui/display/display.h"
31 #include "ui/display/screen.h"
30 #include "ui/events/event.h" 32 #include "ui/events/event.h"
31 #include "ui/gfx/canvas.h" 33 #include "ui/gfx/canvas.h"
32 #include "ui/gfx/path.h" 34 #include "ui/gfx/path.h"
33 #include "ui/native_theme/native_theme_aura.h" 35 #include "ui/native_theme/native_theme_aura.h"
34 #include "ui/platform_window/platform_window_delegate.h" 36 #include "ui/platform_window/platform_window_delegate.h"
35 #include "ui/views/mus/surface_context_factory.h" 37 #include "ui/views/mus/surface_context_factory.h"
36 #include "ui/views/mus/window_manager_constants_converters.h" 38 #include "ui/views/mus/window_manager_constants_converters.h"
37 #include "ui/views/mus/window_manager_frame_values.h" 39 #include "ui/views/mus/window_manager_frame_values.h"
38 #include "ui/views/mus/window_tree_host_mus.h" 40 #include "ui/views/mus/window_tree_host_mus.h"
39 #include "ui/views/widget/native_widget_aura.h" 41 #include "ui/views/widget/native_widget_aura.h"
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } 834 }
833 835
834 ui::InputMethod* NativeWidgetMus::GetInputMethod() { 836 ui::InputMethod* NativeWidgetMus::GetInputMethod() {
835 return window_tree_host_ ? window_tree_host_->GetInputMethod() : nullptr; 837 return window_tree_host_ ? window_tree_host_->GetInputMethod() : nullptr;
836 } 838 }
837 839
838 void NativeWidgetMus::CenterWindow(const gfx::Size& size) { 840 void NativeWidgetMus::CenterWindow(const gfx::Size& size) {
839 // TODO(beng): clear user-placed property and set preferred size property. 841 // TODO(beng): clear user-placed property and set preferred size property.
840 window_->SetSharedProperty<gfx::Size>( 842 window_->SetSharedProperty<gfx::Size>(
841 mus::mojom::WindowManager::kPreferredSize_Property, size); 843 mus::mojom::WindowManager::kPreferredSize_Property, size);
844
845 gfx::Rect bounds = display::Screen::GetScreen()
846 ->GetDisplayNearestWindow(content_)
847 .work_area();
848 bounds.ClampToCenteredSize(size);
849 window_->SetBounds(bounds);
842 } 850 }
843 851
844 void NativeWidgetMus::GetWindowPlacement( 852 void NativeWidgetMus::GetWindowPlacement(
845 gfx::Rect* bounds, 853 gfx::Rect* bounds,
846 ui::WindowShowState* maximized) const { 854 ui::WindowShowState* maximized) const {
847 // NOTIMPLEMENTED(); 855 // NOTIMPLEMENTED();
848 } 856 }
849 857
850 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) { 858 bool NativeWidgetMus::SetWindowTitle(const base::string16& title) {
851 if (!window_) 859 if (!window_)
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 1400
1393 gfx::Path mask_path; 1401 gfx::Path mask_path;
1394 native_widget_delegate_->GetHitTestMask(&mask_path); 1402 native_widget_delegate_->GetHitTestMask(&mask_path);
1395 // TODO(jamescook): Use the full path for the mask. 1403 // TODO(jamescook): Use the full path for the mask.
1396 gfx::Rect mask_rect = 1404 gfx::Rect mask_rect =
1397 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds())); 1405 gfx::ToEnclosingRect(gfx::SkRectToRectF(mask_path.getBounds()));
1398 window_->SetHitTestMask(mask_rect); 1406 window_->SetHitTestMask(mask_rect);
1399 } 1407 }
1400 1408
1401 } // namespace views 1409 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/BUILD.gn ('k') | ui/views/mus/unittests_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698