| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "app/drag_drop_types.h" | 12 #include "app/drag_drop_types.h" |
| 13 #include "app/gfx/chrome_canvas.h" | 13 #include "app/gfx/canvas.h" |
| 14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 17 #include "base/scoped_handle.h" | 17 #include "base/scoped_handle.h" |
| 18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
| 19 #include "third_party/skia/include/core/SkShader.h" | 19 #include "third_party/skia/include/core/SkShader.h" |
| 20 #include "views/background.h" | 20 #include "views/background.h" |
| 21 #include "views/layout_manager.h" | 21 #include "views/layout_manager.h" |
| 22 #include "views/views_delegate.h" | 22 #include "views/views_delegate.h" |
| 23 #include "views/widget/root_view.h" | 23 #include "views/widget/root_view.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void View::SchedulePaint() { | 294 void View::SchedulePaint() { |
| 295 SchedulePaint(GetLocalBounds(true), false); | 295 SchedulePaint(GetLocalBounds(true), false); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void View::SchedulePaint(int x, int y, int w, int h) { | 298 void View::SchedulePaint(int x, int y, int w, int h) { |
| 299 SchedulePaint(gfx::Rect(x, y, w, h), false); | 299 SchedulePaint(gfx::Rect(x, y, w, h), false); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void View::Paint(ChromeCanvas* canvas) { | 302 void View::Paint(gfx::Canvas* canvas) { |
| 303 PaintBackground(canvas); | 303 PaintBackground(canvas); |
| 304 PaintFocusBorder(canvas); | 304 PaintFocusBorder(canvas); |
| 305 PaintBorder(canvas); | 305 PaintBorder(canvas); |
| 306 } | 306 } |
| 307 | 307 |
| 308 void View::PaintBackground(ChromeCanvas* canvas) { | 308 void View::PaintBackground(gfx::Canvas* canvas) { |
| 309 if (background_.get()) | 309 if (background_.get()) |
| 310 background_->Paint(canvas, this); | 310 background_->Paint(canvas, this); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void View::PaintBorder(ChromeCanvas* canvas) { | 313 void View::PaintBorder(gfx::Canvas* canvas) { |
| 314 if (border_.get()) | 314 if (border_.get()) |
| 315 border_->Paint(*this, canvas); | 315 border_->Paint(*this, canvas); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void View::PaintFocusBorder(ChromeCanvas* canvas) { | 318 void View::PaintFocusBorder(gfx::Canvas* canvas) { |
| 319 if (HasFocus() && IsFocusable()) | 319 if (HasFocus() && IsFocusable()) |
| 320 canvas->DrawFocusRect(0, 0, width(), height()); | 320 canvas->DrawFocusRect(0, 0, width(), height()); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void View::PaintChildren(ChromeCanvas* canvas) { | 323 void View::PaintChildren(gfx::Canvas* canvas) { |
| 324 int i, c; | 324 int i, c; |
| 325 for (i = 0, c = GetChildViewCount(); i < c; ++i) { | 325 for (i = 0, c = GetChildViewCount(); i < c; ++i) { |
| 326 View* child = GetChildViewAt(i); | 326 View* child = GetChildViewAt(i); |
| 327 if (!child) { | 327 if (!child) { |
| 328 NOTREACHED() << "Should not have a NULL child View for index in bounds"; | 328 NOTREACHED() << "Should not have a NULL child View for index in bounds"; |
| 329 continue; | 329 continue; |
| 330 } | 330 } |
| 331 child->ProcessPaint(canvas); | 331 child->ProcessPaint(canvas); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 void View::ProcessPaint(ChromeCanvas* canvas) { | 335 void View::ProcessPaint(gfx::Canvas* canvas) { |
| 336 if (!IsVisible()) { | 336 if (!IsVisible()) { |
| 337 return; | 337 return; |
| 338 } | 338 } |
| 339 | 339 |
| 340 // We're going to modify the canvas, save it's state first. | 340 // We're going to modify the canvas, save it's state first. |
| 341 canvas->save(); | 341 canvas->save(); |
| 342 | 342 |
| 343 // Paint this View and its children, setting the clip rect to the bounds | 343 // Paint this View and its children, setting the clip rect to the bounds |
| 344 // of this View and translating the origin to the local bounds' top left | 344 // of this View and translating the origin to the local bounds' top left |
| 345 // point. | 345 // point. |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1356 start_x = start_y = 0; | 1356 start_x = start_y = 0; |
| 1357 } | 1357 } |
| 1358 | 1358 |
| 1359 void View::DragInfo::PossibleDrag(int x, int y) { | 1359 void View::DragInfo::PossibleDrag(int x, int y) { |
| 1360 possible_drag = true; | 1360 possible_drag = true; |
| 1361 start_x = x; | 1361 start_x = x; |
| 1362 start_y = y; | 1362 start_y = y; |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 } // namespace | 1365 } // namespace |
| OLD | NEW |