Chromium Code Reviews| 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 "mojo/services/public/cpp/view_manager/view.h" | 5 #include "mojo/services/public/cpp/view_manager/view.h" |
| 6 | 6 |
| 7 #include "mojo/public/cpp/application/service_provider_impl.h" | 7 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" | 8 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" |
| 9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" | 9 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" |
| 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" | 10 #include "mojo/services/public/cpp/view_manager/view_observer.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 } | 298 } |
| 299 | 299 |
| 300 void View::SetContents(const SkBitmap& contents) { | 300 void View::SetContents(const SkBitmap& contents) { |
| 301 if (manager_) { | 301 if (manager_) { |
| 302 static_cast<ViewManagerClientImpl*>(manager_)->SetViewContents(id_, | 302 static_cast<ViewManagerClientImpl*>(manager_)->SetViewContents(id_, |
| 303 contents); | 303 contents); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 void View::SetColor(SkColor color) { | 307 void View::SetColor(SkColor color) { |
| 308 gfx::Canvas canvas(bounds_.size(), 1.0f, true); | 308 if (manager_) { |
|
Ben Goodger (Google)
2014/09/13 01:22:21
nit: no braces
| |
| 309 canvas.DrawColor(color); | 309 static_cast<ViewManagerClientImpl*>(manager_)->SetViewColor(id_, color); |
| 310 SetContents(skia::GetTopDevice(*canvas.sk_canvas())->accessBitmap(true)); | 310 } |
| 311 } | 311 } |
| 312 | 312 |
| 313 void View::SetFocus() { | 313 void View::SetFocus() { |
| 314 if (manager_) | 314 if (manager_) |
| 315 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); | 315 static_cast<ViewManagerClientImpl*>(manager_)->SetFocus(id_); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void View::Embed(const String& url) { | 318 void View::Embed(const String& url) { |
| 319 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_); | 319 static_cast<ViewManagerClientImpl*>(manager_)->Embed(url, id_); |
| 320 } | 320 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 } | 384 } |
| 385 | 385 |
| 386 void View::LocalSetBounds(const gfx::Rect& old_bounds, | 386 void View::LocalSetBounds(const gfx::Rect& old_bounds, |
| 387 const gfx::Rect& new_bounds) { | 387 const gfx::Rect& new_bounds) { |
| 388 DCHECK(old_bounds == bounds_); | 388 DCHECK(old_bounds == bounds_); |
| 389 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); | 389 ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds); |
| 390 bounds_ = new_bounds; | 390 bounds_ = new_bounds; |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace mojo | 393 } // namespace mojo |
| OLD | NEW |