Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/widget/native_widget_mac.h" | |
| 6 | |
| 7 #include <Cocoa/Cocoa.h> | |
| 8 | |
| 9 #include "ui/compositor/layer_owner.h" | |
|
Andre
2014/05/21 17:13:31
Appears to be unused, do we need this include?
tapted
2014/05/22 12:50:14
Not yet - it's a stray. Removed.
| |
| 10 #include "ui/gfx/font_list.h" | |
| 11 | |
| 12 namespace views { | |
| 13 | |
| 14 //////////////////////////////////////////////////////////////////////////////// | |
| 15 // NativeWidgetMac, public: | |
| 16 | |
| 17 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate) | |
| 18 : delegate_(delegate), window_(nil) { | |
| 19 } | |
| 20 | |
| 21 NativeWidgetMac::~NativeWidgetMac() { | |
| 22 } | |
| 23 | |
| 24 //////////////////////////////////////////////////////////////////////////////// | |
| 25 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: | |
| 26 | |
| 27 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { | |
| 28 // TODO(tapted): Convert position into Cocoa's flipped coordinate space. | |
| 29 NSRect content_rect = | |
| 30 NSMakeRect(0, 0, params.bounds.width(), params.bounds.height()); | |
| 31 // TODO(tapted): Determine a good initial style mask from |params|. | |
| 32 NSInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | |
| 33 NSMiniaturizableWindowMask | NSResizableWindowMask; | |
| 34 window_.reset([[NSWindow alloc] initWithContentRect:content_rect | |
| 35 styleMask:style_mask | |
| 36 backing:NSBackingStoreBuffered | |
| 37 defer:NO]); | |
| 38 } | |
| 39 | |
| 40 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { | |
| 41 return NULL; | |
| 42 } | |
| 43 | |
| 44 bool NativeWidgetMac::ShouldUseNativeFrame() const { | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { | |
| 49 NOTIMPLEMENTED(); | |
| 50 return false; | |
| 51 } | |
| 52 | |
| 53 void NativeWidgetMac::FrameTypeChanged() { | |
| 54 NOTIMPLEMENTED(); | |
| 55 } | |
| 56 | |
| 57 Widget* NativeWidgetMac::GetWidget() { | |
| 58 return delegate_->AsWidget(); | |
| 59 } | |
| 60 | |
| 61 const Widget* NativeWidgetMac::GetWidget() const { | |
| 62 return delegate_->AsWidget(); | |
| 63 } | |
| 64 | |
| 65 gfx::NativeView NativeWidgetMac::GetNativeView() const { | |
| 66 return [window_ contentView]; | |
| 67 } | |
| 68 | |
| 69 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const { | |
| 70 return window_; | |
| 71 } | |
| 72 | |
| 73 Widget* NativeWidgetMac::GetTopLevelWidget() { | |
| 74 NOTIMPLEMENTED(); | |
| 75 return GetWidget(); | |
| 76 } | |
| 77 | |
| 78 const ui::Compositor* NativeWidgetMac::GetCompositor() const { | |
| 79 NOTIMPLEMENTED(); | |
| 80 return NULL; | |
| 81 } | |
| 82 | |
| 83 ui::Compositor* NativeWidgetMac::GetCompositor() { | |
| 84 NOTIMPLEMENTED(); | |
| 85 return NULL; | |
| 86 } | |
| 87 | |
| 88 ui::Layer* NativeWidgetMac::GetLayer() { | |
| 89 NOTIMPLEMENTED(); | |
| 90 return NULL; | |
| 91 } | |
| 92 | |
| 93 void NativeWidgetMac::ReorderNativeViews() { | |
| 94 NOTIMPLEMENTED(); | |
| 95 } | |
| 96 | |
| 97 void NativeWidgetMac::ViewRemoved(View* view) { | |
| 98 NOTIMPLEMENTED(); | |
| 99 } | |
| 100 | |
| 101 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) { | |
| 102 NOTIMPLEMENTED(); | |
| 103 } | |
| 104 | |
| 105 void* NativeWidgetMac::GetNativeWindowProperty(const char* name) const { | |
|
Andre
2014/05/21 17:13:31
Why doesn't this one have NOTIMPLEMENTED() like th
tapted
2014/05/22 12:50:14
Fixed.
Good question. It was deliberate, the rati
| |
| 106 return NULL; | |
| 107 } | |
| 108 | |
| 109 TooltipManager* NativeWidgetMac::GetTooltipManager() const { | |
| 110 NOTIMPLEMENTED(); | |
| 111 return NULL; | |
| 112 } | |
| 113 | |
| 114 void NativeWidgetMac::SetCapture() { | |
| 115 NOTIMPLEMENTED(); | |
| 116 } | |
| 117 | |
| 118 void NativeWidgetMac::ReleaseCapture() { | |
| 119 NOTIMPLEMENTED(); | |
| 120 } | |
| 121 | |
| 122 bool NativeWidgetMac::HasCapture() const { | |
| 123 NOTIMPLEMENTED(); | |
| 124 return false; | |
| 125 } | |
| 126 | |
| 127 InputMethod* NativeWidgetMac::CreateInputMethod() { | |
| 128 NOTIMPLEMENTED(); | |
| 129 return NULL; | |
| 130 } | |
| 131 | |
| 132 InputMethodDelegate* NativeWidgetMac::GetInputMethodDelegate() { | |
| 133 NOTIMPLEMENTED(); | |
| 134 return NULL; | |
| 135 } | |
| 136 | |
| 137 ui::InputMethod* NativeWidgetMac::GetHostInputMethod() { | |
| 138 NOTIMPLEMENTED(); | |
| 139 return NULL; | |
| 140 } | |
| 141 | |
| 142 void NativeWidgetMac::CenterWindow(const gfx::Size& size) { | |
| 143 NOTIMPLEMENTED(); | |
| 144 } | |
| 145 | |
| 146 void NativeWidgetMac::GetWindowPlacement(gfx::Rect* bounds, | |
| 147 ui::WindowShowState* maximized) const { | |
| 148 NOTIMPLEMENTED(); | |
| 149 } | |
| 150 | |
| 151 bool NativeWidgetMac::SetWindowTitle(const base::string16& title) { | |
| 152 NOTIMPLEMENTED(); | |
| 153 return false; | |
| 154 } | |
| 155 | |
| 156 void NativeWidgetMac::SetWindowIcons(const gfx::ImageSkia& window_icon, | |
| 157 const gfx::ImageSkia& app_icon) { | |
| 158 NOTIMPLEMENTED(); | |
| 159 } | |
| 160 | |
| 161 void NativeWidgetMac::InitModalType(ui::ModalType modal_type) { | |
| 162 NOTIMPLEMENTED(); | |
| 163 } | |
| 164 | |
| 165 gfx::Rect NativeWidgetMac::GetWindowBoundsInScreen() const { | |
| 166 NOTIMPLEMENTED(); | |
| 167 return gfx::Rect(); | |
| 168 } | |
| 169 | |
| 170 gfx::Rect NativeWidgetMac::GetClientAreaBoundsInScreen() const { | |
| 171 NOTIMPLEMENTED(); | |
| 172 return gfx::Rect(); | |
| 173 } | |
| 174 | |
| 175 gfx::Rect NativeWidgetMac::GetRestoredBounds() const { | |
| 176 NOTIMPLEMENTED(); | |
| 177 return gfx::Rect(); | |
| 178 } | |
| 179 | |
| 180 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { | |
| 181 NOTIMPLEMENTED(); | |
| 182 } | |
| 183 | |
| 184 void NativeWidgetMac::SetSize(const gfx::Size& size) { | |
| 185 [window_ setContentSize:NSMakeSize(size.width(), size.height())]; | |
| 186 } | |
| 187 | |
| 188 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) { | |
| 189 NOTIMPLEMENTED(); | |
| 190 } | |
| 191 | |
| 192 void NativeWidgetMac::StackAtTop() { | |
| 193 NOTIMPLEMENTED(); | |
| 194 } | |
| 195 | |
| 196 void NativeWidgetMac::StackBelow(gfx::NativeView native_view) { | |
| 197 NOTIMPLEMENTED(); | |
| 198 } | |
| 199 | |
| 200 void NativeWidgetMac::SetShape(gfx::NativeRegion shape) { | |
| 201 NOTIMPLEMENTED(); | |
| 202 } | |
| 203 | |
| 204 void NativeWidgetMac::Close() { | |
| 205 NOTIMPLEMENTED(); | |
| 206 } | |
| 207 | |
| 208 void NativeWidgetMac::CloseNow() { | |
| 209 NOTIMPLEMENTED(); | |
| 210 } | |
| 211 | |
| 212 void NativeWidgetMac::Show() { | |
| 213 NOTIMPLEMENTED(); | |
| 214 } | |
| 215 | |
| 216 void NativeWidgetMac::Hide() { | |
| 217 NOTIMPLEMENTED(); | |
| 218 } | |
| 219 | |
| 220 void NativeWidgetMac::ShowMaximizedWithBounds( | |
| 221 const gfx::Rect& restored_bounds) { | |
| 222 NOTIMPLEMENTED(); | |
| 223 } | |
| 224 | |
| 225 void NativeWidgetMac::ShowWithWindowState(ui::WindowShowState state) { | |
| 226 NOTIMPLEMENTED(); | |
| 227 } | |
| 228 | |
| 229 bool NativeWidgetMac::IsVisible() const { | |
| 230 NOTIMPLEMENTED(); | |
| 231 return true; | |
| 232 } | |
| 233 | |
| 234 void NativeWidgetMac::Activate() { | |
| 235 NOTIMPLEMENTED(); | |
| 236 } | |
| 237 | |
| 238 void NativeWidgetMac::Deactivate() { | |
| 239 NOTIMPLEMENTED(); | |
| 240 } | |
| 241 | |
| 242 bool NativeWidgetMac::IsActive() const { | |
| 243 NOTIMPLEMENTED(); | |
| 244 return true; | |
| 245 } | |
| 246 | |
| 247 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) { | |
| 248 NOTIMPLEMENTED(); | |
| 249 } | |
| 250 | |
| 251 bool NativeWidgetMac::IsAlwaysOnTop() const { | |
| 252 NOTIMPLEMENTED(); | |
| 253 return false; | |
| 254 } | |
| 255 | |
| 256 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) { | |
| 257 NOTIMPLEMENTED(); | |
| 258 } | |
| 259 | |
| 260 void NativeWidgetMac::Maximize() { | |
| 261 NOTIMPLEMENTED(); | |
| 262 } | |
| 263 | |
| 264 void NativeWidgetMac::Minimize() { | |
| 265 NOTIMPLEMENTED(); | |
| 266 } | |
| 267 | |
| 268 bool NativeWidgetMac::IsMaximized() const { | |
| 269 NOTIMPLEMENTED(); | |
| 270 return false; | |
| 271 } | |
| 272 | |
| 273 bool NativeWidgetMac::IsMinimized() const { | |
| 274 NOTIMPLEMENTED(); | |
| 275 return false; | |
| 276 } | |
| 277 | |
| 278 void NativeWidgetMac::Restore() { | |
| 279 NOTIMPLEMENTED(); | |
| 280 } | |
| 281 | |
| 282 void NativeWidgetMac::SetFullscreen(bool fullscreen) { | |
| 283 NOTIMPLEMENTED(); | |
| 284 } | |
| 285 | |
| 286 bool NativeWidgetMac::IsFullscreen() const { | |
| 287 NOTIMPLEMENTED(); | |
| 288 return false; | |
| 289 } | |
| 290 | |
| 291 void NativeWidgetMac::SetOpacity(unsigned char opacity) { | |
| 292 NOTIMPLEMENTED(); | |
| 293 } | |
| 294 | |
| 295 void NativeWidgetMac::SetUseDragFrame(bool use_drag_frame) { | |
| 296 NOTIMPLEMENTED(); | |
| 297 } | |
| 298 | |
| 299 void NativeWidgetMac::FlashFrame(bool flash_frame) { | |
| 300 NOTIMPLEMENTED(); | |
| 301 } | |
| 302 | |
| 303 void NativeWidgetMac::RunShellDrag(View* view, | |
| 304 const ui::OSExchangeData& data, | |
| 305 const gfx::Point& location, | |
| 306 int operation, | |
| 307 ui::DragDropTypes::DragEventSource source) { | |
| 308 NOTIMPLEMENTED(); | |
| 309 } | |
| 310 | |
| 311 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { | |
| 312 NOTIMPLEMENTED(); | |
| 313 } | |
| 314 | |
| 315 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { | |
| 316 NOTIMPLEMENTED(); | |
| 317 } | |
| 318 | |
| 319 bool NativeWidgetMac::IsMouseEventsEnabled() const { | |
| 320 NOTIMPLEMENTED(); | |
| 321 return true; | |
| 322 } | |
| 323 | |
| 324 void NativeWidgetMac::ClearNativeFocus() { | |
| 325 NOTIMPLEMENTED(); | |
| 326 } | |
| 327 | |
| 328 gfx::Rect NativeWidgetMac::GetWorkAreaBoundsInScreen() const { | |
| 329 NOTIMPLEMENTED(); | |
| 330 return gfx::Rect(); | |
| 331 } | |
| 332 | |
| 333 Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop( | |
| 334 const gfx::Vector2d& drag_offset, | |
| 335 Widget::MoveLoopSource source, | |
| 336 Widget::MoveLoopEscapeBehavior escape_behavior) { | |
| 337 NOTIMPLEMENTED(); | |
| 338 return Widget::MOVE_LOOP_CANCELED; | |
| 339 } | |
| 340 | |
| 341 void NativeWidgetMac::EndMoveLoop() { | |
| 342 NOTIMPLEMENTED(); | |
| 343 } | |
| 344 | |
| 345 void NativeWidgetMac::SetVisibilityChangedAnimationsEnabled(bool value) { | |
| 346 NOTIMPLEMENTED(); | |
| 347 } | |
| 348 | |
| 349 ui::NativeTheme* NativeWidgetMac::GetNativeTheme() const { | |
| 350 NOTIMPLEMENTED(); | |
| 351 return NULL;; | |
| 352 } | |
| 353 | |
| 354 void NativeWidgetMac::OnRootViewLayout() const { | |
| 355 NOTIMPLEMENTED(); | |
| 356 } | |
| 357 | |
| 358 //////////////////////////////////////////////////////////////////////////////// | |
| 359 // NativeWidgetMac, NativeWidget implementation: | |
| 360 | |
| 361 ui::EventHandler* NativeWidgetMac::GetEventHandler() { | |
| 362 return NULL; | |
| 363 } | |
| 364 | |
| 365 //////////////////////////////////////////////////////////////////////////////// | |
| 366 // Widget, public: | |
| 367 | |
| 368 bool Widget::ConvertRect(const Widget* source, | |
| 369 const Widget* target, | |
| 370 gfx::Rect* rect) { | |
| 371 return false; | |
| 372 } | |
| 373 | |
| 374 namespace internal { | |
| 375 | |
| 376 //////////////////////////////////////////////////////////////////////////////// | |
| 377 // internal::NativeWidgetPrivate, public: | |
| 378 | |
| 379 // static | |
| 380 NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget( | |
| 381 internal::NativeWidgetDelegate* delegate) { | |
| 382 NOTIMPLEMENTED(); | |
| 383 return NULL; | |
| 384 } | |
| 385 | |
| 386 // static | |
| 387 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView( | |
| 388 gfx::NativeView native_view) { | |
| 389 NOTIMPLEMENTED(); | |
| 390 return NULL; | |
| 391 } | |
| 392 | |
| 393 // static | |
| 394 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow( | |
| 395 gfx::NativeWindow native_window) { | |
| 396 NOTIMPLEMENTED(); | |
| 397 return NULL; | |
| 398 } | |
| 399 | |
| 400 // static | |
| 401 NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( | |
| 402 gfx::NativeView native_view) { | |
| 403 NOTIMPLEMENTED(); | |
| 404 return NULL; | |
| 405 } | |
| 406 | |
| 407 // static | |
| 408 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, | |
| 409 Widget::Widgets* children) { | |
| 410 NOTIMPLEMENTED(); | |
| 411 } | |
| 412 | |
| 413 // static | |
| 414 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, | |
| 415 Widget::Widgets* owned) { | |
| 416 NOTIMPLEMENTED(); | |
| 417 } | |
| 418 | |
| 419 // static | |
| 420 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, | |
| 421 gfx::NativeView new_parent) { | |
| 422 NOTIMPLEMENTED(); | |
| 423 } | |
| 424 | |
| 425 // static | |
| 426 bool NativeWidgetPrivate::IsMouseButtonDown() { | |
| 427 NOTIMPLEMENTED(); | |
| 428 return false; | |
| 429 } | |
| 430 | |
| 431 // static | |
| 432 bool NativeWidgetPrivate::IsTouchDown() { | |
| 433 NOTIMPLEMENTED(); | |
| 434 return false; | |
| 435 } | |
| 436 | |
| 437 // static | |
| 438 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | |
| 439 NOTIMPLEMENTED(); | |
| 440 return gfx::FontList(); | |
| 441 } | |
| 442 | |
| 443 } // namespace internal | |
| 444 } // namespace views | |
| OLD | NEW |