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

Side by Side Diff: views/view.h

Issue 7273073: Animated Rotation (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Listen for painting to complete rather than posting tasks. Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef VIEWS_VIEW_H_ 5 #ifndef VIEWS_VIEW_H_
6 #define VIEWS_VIEW_H_ 6 #define VIEWS_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 class Background; 51 class Background;
52 class Border; 52 class Border;
53 class ContextMenuController; 53 class ContextMenuController;
54 class DragController; 54 class DragController;
55 class FocusManager; 55 class FocusManager;
56 class FocusTraversable; 56 class FocusTraversable;
57 class InputMethod; 57 class InputMethod;
58 class LayerPropertySetter; 58 class LayerPropertySetter;
59 class LayoutManager; 59 class LayoutManager;
60 class PaintListener;
60 class ScrollView; 61 class ScrollView;
61 class TextInputClient; 62 class TextInputClient;
62 class Widget; 63 class Widget;
63 64
64 namespace internal { 65 namespace internal {
65 class NativeWidgetView; 66 class NativeWidgetView;
66 class RootView; 67 class RootView;
67 } 68 }
68 69
69 ///////////////////////////////////////////////////////////////////////////// 70 /////////////////////////////////////////////////////////////////////////////
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 Background* background() { return background_.get(); } 470 Background* background() { return background_.get(); }
470 471
471 // The border object is owned by this object and may be NULL. 472 // The border object is owned by this object and may be NULL.
472 void set_border(Border* b) { border_.reset(b); } 473 void set_border(Border* b) { border_.reset(b); }
473 const Border* border() const { return border_.get(); } 474 const Border* border() const { return border_.get(); }
474 Border* border() { return border_.get(); } 475 Border* border() { return border_.get(); }
475 476
476 // Get the theme provider from the parent widget. 477 // Get the theme provider from the parent widget.
477 virtual ui::ThemeProvider* GetThemeProvider() const; 478 virtual ui::ThemeProvider* GetThemeProvider() const;
478 479
480 // Add/Remove listeners that are notified when painting and compositing end.
481 // The view does not own the listeners, and it is the responsibility of the
482 // listener to remove itself when it is done listening.
483 void AddPaintListener(PaintListener* listener);
484 void RemovePaintListener(PaintListener* listener);
485
479 // RTL painting -------------------------------------------------------------- 486 // RTL painting --------------------------------------------------------------
480 487
481 // This method determines whether the gfx::Canvas object passed to 488 // This method determines whether the gfx::Canvas object passed to
482 // View::Paint() needs to be transformed such that anything drawn on the 489 // View::Paint() needs to be transformed such that anything drawn on the
483 // canvas object during View::Paint() is flipped horizontally. 490 // canvas object during View::Paint() is flipped horizontally.
484 // 491 //
485 // By default, this function returns false (which is the initial value of 492 // By default, this function returns false (which is the initial value of
486 // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on 493 // |flip_canvas_on_paint_for_rtl_ui_|). View subclasses that need to paint on
487 // a flipped gfx::Canvas when the UI layout is right-to-left need to call 494 // a flipped gfx::Canvas when the UI layout is right-to-left need to call
488 // EnableCanvasFlippingForRTLUI(). 495 // EnableCanvasFlippingForRTLUI().
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 // used by the public static method ExceededDragThreshold(). 1104 // used by the public static method ExceededDragThreshold().
1098 static int GetHorizontalDragThreshold(); 1105 static int GetHorizontalDragThreshold();
1099 static int GetVerticalDragThreshold(); 1106 static int GetVerticalDragThreshold();
1100 1107
1101 private: 1108 private:
1102 friend class internal::NativeWidgetView; 1109 friend class internal::NativeWidgetView;
1103 friend class internal::RootView; 1110 friend class internal::RootView;
1104 friend class FocusManager; 1111 friend class FocusManager;
1105 friend class ViewStorage; 1112 friend class ViewStorage;
1106 friend class Widget; 1113 friend class Widget;
1114 friend class PaintLock;
1107 1115
1108 // Used to track a drag. RootView passes this into 1116 // Used to track a drag. RootView passes this into
1109 // ProcessMousePressed/Dragged. 1117 // ProcessMousePressed/Dragged.
1110 struct DragInfo { 1118 struct DragInfo {
1111 // Sets possible_drag to false and start_x/y to 0. This is invoked by 1119 // Sets possible_drag to false and start_x/y to 0. This is invoked by
1112 // RootView prior to invoke ProcessMousePressed. 1120 // RootView prior to invoke ProcessMousePressed.
1113 void Reset(); 1121 void Reset();
1114 1122
1115 // Sets possible_drag to true and start_pt to the specified point. 1123 // Sets possible_drag to true and start_pt to the specified point.
1116 // This is invoked by the target view if it detects the press may generate 1124 // This is invoked by the target view if it detects the press may generate
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const; 1230 bool ConvertPointForAncestor(const View* ancestor, gfx::Point* point) const;
1223 1231
1224 // Convert a point in the ancestor's coordinate system to the view's 1232 // Convert a point in the ancestor's coordinate system to the view's
1225 // coordinate system using necessary transformations. Returns whether the 1233 // coordinate system using necessary transformations. Returns whether the
1226 // point was successfully from the ancestor's coordinate system to the view's 1234 // point was successfully from the ancestor's coordinate system to the view's
1227 // coordinate system. 1235 // coordinate system.
1228 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const; 1236 bool ConvertPointFromAncestor(const View* ancestor, gfx::Point* point) const;
1229 1237
1230 // Accelerated painting ------------------------------------------------------ 1238 // Accelerated painting ------------------------------------------------------
1231 1239
1240 // Disables painting during time-critical operations. Used by PaintLock.
1241 void set_painting_enabled(bool enabled) { painting_enabled_ = enabled; }
1242
1232 // Returns true if this view should paint to layer. 1243 // Returns true if this view should paint to layer.
1233 bool ShouldPaintToLayer() const; 1244 bool ShouldPaintToLayer() const;
1234 1245
1235 // Creates the layer and related fields for this view. 1246 // Creates the layer and related fields for this view.
1236 void CreateLayer(); 1247 void CreateLayer();
1237 1248
1238 // Reparents any descendant layer to our current layer parent and destroys 1249 // Reparents any descendant layer to our current layer parent and destroys
1239 // this views layer. 1250 // this views layer.
1240 void DestroyLayerAndReparent(); 1251 void DestroyLayerAndReparent();
1241 1252
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 1357
1347 // This View's bounds in the parent coordinate system. 1358 // This View's bounds in the parent coordinate system.
1348 gfx::Rect bounds_; 1359 gfx::Rect bounds_;
1349 1360
1350 // Whether this view is visible. 1361 // Whether this view is visible.
1351 bool visible_; 1362 bool visible_;
1352 1363
1353 // Whether this view is enabled. 1364 // Whether this view is enabled.
1354 bool enabled_; 1365 bool enabled_;
1355 1366
1367 // Whether this view is painting.
1368 bool painting_enabled_;
1369
1356 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView 1370 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView
1357 // has been invoked. 1371 // has been invoked.
1358 bool registered_for_visible_bounds_notification_; 1372 bool registered_for_visible_bounds_notification_;
1359 1373
1360 // List of descendants wanting notification when their visible bounds change. 1374 // List of descendants wanting notification when their visible bounds change.
1361 scoped_ptr<Views> descendants_to_notify_; 1375 scoped_ptr<Views> descendants_to_notify_;
1362 1376
1363 // Transformations ----------------------------------------------------------- 1377 // Transformations -----------------------------------------------------------
1364 1378
1365 // Clipping parameters. skia transformation matrix does not give us clipping. 1379 // Clipping parameters. skia transformation matrix does not give us clipping.
(...skipping 11 matching lines...) Expand all
1377 scoped_ptr<LayoutManager> layout_manager_; 1391 scoped_ptr<LayoutManager> layout_manager_;
1378 1392
1379 // Painting ------------------------------------------------------------------ 1393 // Painting ------------------------------------------------------------------
1380 1394
1381 // Background 1395 // Background
1382 scoped_ptr<Background> background_; 1396 scoped_ptr<Background> background_;
1383 1397
1384 // Border. 1398 // Border.
1385 scoped_ptr<Border> border_; 1399 scoped_ptr<Border> border_;
1386 1400
1401 // Listeners. These are not owned by the view.
1402 std::set<PaintListener*> paint_listeners_;
sky 2011/08/26 19:10:25 Use ObserverList (in base) for this. I don't like
1403
1387 // RTL painting -------------------------------------------------------------- 1404 // RTL painting --------------------------------------------------------------
1388 1405
1389 // Indicates whether or not the gfx::Canvas object passed to View::Paint() 1406 // Indicates whether or not the gfx::Canvas object passed to View::Paint()
1390 // is going to be flipped horizontally (using the appropriate transform) on 1407 // is going to be flipped horizontally (using the appropriate transform) on
1391 // right-to-left locales for this View. 1408 // right-to-left locales for this View.
1392 bool flip_canvas_on_paint_for_rtl_ui_; 1409 bool flip_canvas_on_paint_for_rtl_ui_;
1393 1410
1394 // Accelerated painting ------------------------------------------------------ 1411 // Accelerated painting ------------------------------------------------------
1395 1412
1396 scoped_ptr<internal::LayerHelper> layer_helper_; 1413 scoped_ptr<internal::LayerHelper> layer_helper_;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 #if defined(OS_WIN) 1457 #if defined(OS_WIN)
1441 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; 1458 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_;
1442 #endif 1459 #endif
1443 1460
1444 DISALLOW_COPY_AND_ASSIGN(View); 1461 DISALLOW_COPY_AND_ASSIGN(View);
1445 }; 1462 };
1446 1463
1447 } // namespace views 1464 } // namespace views
1448 1465
1449 #endif // VIEWS_VIEW_H_ 1466 #endif // VIEWS_VIEW_H_
OLDNEW
« views/paint_listener.cc ('K') | « views/paint_lock.cc ('k') | views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698