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

Side by Side Diff: extensions/shell/browser/shell_desktop_controller.cc

Issue 667153007: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "extensions/shell/browser/shell_desktop_controller.h" 5 #include "extensions/shell/browser/shell_desktop_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "ui/display/types/display_snapshot.h" 42 #include "ui/display/types/display_snapshot.h"
43 #endif 43 #endif
44 44
45 namespace extensions { 45 namespace extensions {
46 namespace { 46 namespace {
47 47
48 // A simple layout manager that makes each new window fill its parent. 48 // A simple layout manager that makes each new window fill its parent.
49 class FillLayout : public aura::LayoutManager { 49 class FillLayout : public aura::LayoutManager {
50 public: 50 public:
51 FillLayout() {} 51 FillLayout() {}
52 virtual ~FillLayout() {} 52 ~FillLayout() override {}
53 53
54 private: 54 private:
55 // aura::LayoutManager: 55 // aura::LayoutManager:
56 virtual void OnWindowResized() override {} 56 void OnWindowResized() override {}
57 57
58 virtual void OnWindowAddedToLayout(aura::Window* child) override { 58 void OnWindowAddedToLayout(aura::Window* child) override {
59 if (!child->parent()) 59 if (!child->parent())
60 return; 60 return;
61 61
62 // Create a rect at 0,0 with the size of the parent. 62 // Create a rect at 0,0 with the size of the parent.
63 gfx::Size parent_size = child->parent()->bounds().size(); 63 gfx::Size parent_size = child->parent()->bounds().size();
64 child->SetBounds(gfx::Rect(parent_size)); 64 child->SetBounds(gfx::Rect(parent_size));
65 } 65 }
66 66
67 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) override {} 67 void OnWillRemoveWindowFromLayout(aura::Window* child) override {}
68 68
69 virtual void OnWindowRemovedFromLayout(aura::Window* child) override {} 69 void OnWindowRemovedFromLayout(aura::Window* child) override {}
70 70
71 virtual void OnChildWindowVisibilityChanged(aura::Window* child, 71 void OnChildWindowVisibilityChanged(aura::Window* child,
72 bool visible) override {} 72 bool visible) override {}
73 73
74 virtual void SetChildBounds(aura::Window* child, 74 void SetChildBounds(aura::Window* child,
75 const gfx::Rect& requested_bounds) override { 75 const gfx::Rect& requested_bounds) override {
76 SetChildBoundsDirect(child, requested_bounds); 76 SetChildBoundsDirect(child, requested_bounds);
77 } 77 }
78 78
79 DISALLOW_COPY_AND_ASSIGN(FillLayout); 79 DISALLOW_COPY_AND_ASSIGN(FillLayout);
80 }; 80 };
81 81
82 // A class that bridges the gap between CursorManager and Aura. It borrows 82 // A class that bridges the gap between CursorManager and Aura. It borrows
83 // heavily from AshNativeCursorManager. 83 // heavily from AshNativeCursorManager.
84 class ShellNativeCursorManager : public wm::NativeCursorManager { 84 class ShellNativeCursorManager : public wm::NativeCursorManager {
85 public: 85 public:
86 explicit ShellNativeCursorManager(aura::WindowTreeHost* host) 86 explicit ShellNativeCursorManager(aura::WindowTreeHost* host)
87 : host_(host), image_cursors_(new ui::ImageCursors) {} 87 : host_(host), image_cursors_(new ui::ImageCursors) {}
88 virtual ~ShellNativeCursorManager() {} 88 ~ShellNativeCursorManager() override {}
89 89
90 // wm::NativeCursorManager overrides. 90 // wm::NativeCursorManager overrides.
91 virtual void SetDisplay(const gfx::Display& display, 91 void SetDisplay(const gfx::Display& display,
92 wm::NativeCursorManagerDelegate* delegate) override { 92 wm::NativeCursorManagerDelegate* delegate) override {
93 if (image_cursors_->SetDisplay(display, display.device_scale_factor())) 93 if (image_cursors_->SetDisplay(display, display.device_scale_factor()))
94 SetCursor(delegate->GetCursor(), delegate); 94 SetCursor(delegate->GetCursor(), delegate);
95 } 95 }
96 96
97 virtual void SetCursor(gfx::NativeCursor cursor, 97 void SetCursor(gfx::NativeCursor cursor,
98 wm::NativeCursorManagerDelegate* delegate) override { 98 wm::NativeCursorManagerDelegate* delegate) override {
99 image_cursors_->SetPlatformCursor(&cursor); 99 image_cursors_->SetPlatformCursor(&cursor);
100 cursor.set_device_scale_factor(image_cursors_->GetScale()); 100 cursor.set_device_scale_factor(image_cursors_->GetScale());
101 delegate->CommitCursor(cursor); 101 delegate->CommitCursor(cursor);
102 102
103 if (delegate->IsCursorVisible()) 103 if (delegate->IsCursorVisible())
104 ApplyCursor(cursor); 104 ApplyCursor(cursor);
105 } 105 }
106 106
107 virtual void SetVisibility( 107 void SetVisibility(bool visible,
108 bool visible, 108 wm::NativeCursorManagerDelegate* delegate) override {
109 wm::NativeCursorManagerDelegate* delegate) override {
110 delegate->CommitVisibility(visible); 109 delegate->CommitVisibility(visible);
111 110
112 if (visible) { 111 if (visible) {
113 SetCursor(delegate->GetCursor(), delegate); 112 SetCursor(delegate->GetCursor(), delegate);
114 } else { 113 } else {
115 gfx::NativeCursor invisible_cursor(ui::kCursorNone); 114 gfx::NativeCursor invisible_cursor(ui::kCursorNone);
116 image_cursors_->SetPlatformCursor(&invisible_cursor); 115 image_cursors_->SetPlatformCursor(&invisible_cursor);
117 ApplyCursor(invisible_cursor); 116 ApplyCursor(invisible_cursor);
118 } 117 }
119 } 118 }
120 119
121 virtual void SetCursorSet( 120 void SetCursorSet(ui::CursorSetType cursor_set,
122 ui::CursorSetType cursor_set, 121 wm::NativeCursorManagerDelegate* delegate) override {
123 wm::NativeCursorManagerDelegate* delegate) override {
124 image_cursors_->SetCursorSet(cursor_set); 122 image_cursors_->SetCursorSet(cursor_set);
125 delegate->CommitCursorSet(cursor_set); 123 delegate->CommitCursorSet(cursor_set);
126 if (delegate->IsCursorVisible()) 124 if (delegate->IsCursorVisible())
127 SetCursor(delegate->GetCursor(), delegate); 125 SetCursor(delegate->GetCursor(), delegate);
128 } 126 }
129 127
130 virtual void SetMouseEventsEnabled( 128 void SetMouseEventsEnabled(
131 bool enabled, 129 bool enabled,
132 wm::NativeCursorManagerDelegate* delegate) override { 130 wm::NativeCursorManagerDelegate* delegate) override {
133 delegate->CommitMouseEventsEnabled(enabled); 131 delegate->CommitMouseEventsEnabled(enabled);
134 SetVisibility(delegate->IsCursorVisible(), delegate); 132 SetVisibility(delegate->IsCursorVisible(), delegate);
135 } 133 }
136 134
137 private: 135 private:
138 // Sets |cursor| as the active cursor within Aura. 136 // Sets |cursor| as the active cursor within Aura.
139 void ApplyCursor(gfx::NativeCursor cursor) { host_->SetCursor(cursor); } 137 void ApplyCursor(gfx::NativeCursor cursor) { host_->SetCursor(cursor); }
140 138
141 aura::WindowTreeHost* host_; // Not owned. 139 aura::WindowTreeHost* host_; // Not owned.
142 140
143 scoped_ptr<ui::ImageCursors> image_cursors_; 141 scoped_ptr<ui::ImageCursors> image_cursors_;
144 142
145 DISALLOW_COPY_AND_ASSIGN(ShellNativeCursorManager); 143 DISALLOW_COPY_AND_ASSIGN(ShellNativeCursorManager);
146 }; 144 };
147 145
148 class AppsFocusRules : public wm::BaseFocusRules { 146 class AppsFocusRules : public wm::BaseFocusRules {
149 public: 147 public:
150 AppsFocusRules() {} 148 AppsFocusRules() {}
151 virtual ~AppsFocusRules() {} 149 ~AppsFocusRules() override {}
152 150
153 virtual bool SupportsChildActivation(aura::Window* window) const override { 151 bool SupportsChildActivation(aura::Window* window) const override {
154 return true; 152 return true;
155 } 153 }
156 154
157 private: 155 private:
158 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); 156 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules);
159 }; 157 };
160 158
161 } // namespace 159 } // namespace
162 160
163 ShellDesktopController::ShellDesktopController() 161 ShellDesktopController::ShellDesktopController()
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (displays.empty()) 352 if (displays.empty())
355 return gfx::Size(); 353 return gfx::Size();
356 const ui::DisplayMode* mode = displays[0].display->current_mode(); 354 const ui::DisplayMode* mode = displays[0].display->current_mode();
357 return mode ? mode->size() : gfx::Size(); 355 return mode ? mode->size() : gfx::Size();
358 #else 356 #else
359 return gfx::Size(); 357 return gfx::Size();
360 #endif 358 #endif
361 } 359 }
362 360
363 } // namespace extensions 361 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_desktop_controller.h ('k') | extensions/shell/browser/shell_desktop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698