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

Side by Side Diff: ui/views/view.h

Issue 10412044: layers: Consolidate the ownership of layers in views::View and aura::Window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « ui/compositor/layer_owner.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_VIEW_H_ 5 #ifndef UI_VIEWS_VIEW_H_
6 #define UI_VIEWS_VIEW_H_ 6 #define UI_VIEWS_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/i18n/rtl.h" 16 #include "base/i18n/rtl.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "ui/base/accelerators/accelerator.h" 20 #include "ui/base/accelerators/accelerator.h"
21 #include "ui/base/dragdrop/os_exchange_data.h" 21 #include "ui/base/dragdrop/os_exchange_data.h"
22 #include "ui/compositor/layer_delegate.h" 22 #include "ui/compositor/layer_delegate.h"
23 #include "ui/compositor/layer_owner.h"
23 #include "ui/gfx/native_widget_types.h" 24 #include "ui/gfx/native_widget_types.h"
24 #include "ui/gfx/rect.h" 25 #include "ui/gfx/rect.h"
25 #include "ui/views/background.h" 26 #include "ui/views/background.h"
26 #include "ui/views/border.h" 27 #include "ui/views/border.h"
27 #include "ui/views/events/event.h" 28 #include "ui/views/events/event.h"
28 29
29 #if defined(OS_WIN) 30 #if defined(OS_WIN)
30 #include "base/win/scoped_comptr.h" 31 #include "base/win/scoped_comptr.h"
31 #endif 32 #endif
32 33
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // LayoutManager interface can be used to lay out children if required. 90 // LayoutManager interface can be used to lay out children if required.
90 // 91 //
91 // It is up to the subclass to implement Painting and storage of subclass - 92 // It is up to the subclass to implement Painting and storage of subclass -
92 // specific properties and functionality. 93 // specific properties and functionality.
93 // 94 //
94 // Unless otherwise documented, views is not thread safe and should only be 95 // Unless otherwise documented, views is not thread safe and should only be
95 // accessed from the main thread. 96 // accessed from the main thread.
96 // 97 //
97 ///////////////////////////////////////////////////////////////////////////// 98 /////////////////////////////////////////////////////////////////////////////
98 class VIEWS_EXPORT View : public ui::LayerDelegate, 99 class VIEWS_EXPORT View : public ui::LayerDelegate,
100 public ui::LayerOwner,
99 public ui::AcceleratorTarget { 101 public ui::AcceleratorTarget {
100 public: 102 public:
101 typedef std::vector<View*> Views; 103 typedef std::vector<View*> Views;
102 104
103 // Creation and lifetime ----------------------------------------------------- 105 // Creation and lifetime -----------------------------------------------------
104 106
105 View(); 107 View();
106 virtual ~View(); 108 virtual ~View();
107 109
108 // By default a View is owned by its parent unless specified otherwise here. 110 // By default a View is owned by its parent unless specified otherwise here.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void SetTransform(const ui::Transform& transform); 273 void SetTransform(const ui::Transform& transform);
272 274
273 // Sets whether this view paints to a layer. A view paints to a layer if 275 // Sets whether this view paints to a layer. A view paints to a layer if
274 // either of the following are true: 276 // either of the following are true:
275 // . the view has a non-identity transform. 277 // . the view has a non-identity transform.
276 // . SetPaintToLayer(true) has been invoked. 278 // . SetPaintToLayer(true) has been invoked.
277 // View creates the Layer only when it exists in a Widget with a non-NULL 279 // View creates the Layer only when it exists in a Widget with a non-NULL
278 // Compositor. 280 // Compositor.
279 void SetPaintToLayer(bool paint_to_layer); 281 void SetPaintToLayer(bool paint_to_layer);
280 282
281 const ui::Layer* layer() const { return layer_.get(); } 283 // Recreates a layer for the view and returns the old layer. After this call,
282 ui::Layer* layer() { return layer_.get(); } 284 // the View no longer has a pointer to the old layer (so it won't be able to
285 // update the old layer or destroy it). The caller must free the returned
286 // layer.
287 ui::Layer* RecreateLayer() WARN_UNUSED_RESULT;
283 288
284 // RTL positioning ----------------------------------------------------------- 289 // RTL positioning -----------------------------------------------------------
285 290
286 // Methods for accessing the bounds and position of the view, relative to its 291 // Methods for accessing the bounds and position of the view, relative to its
287 // parent. The position returned is mirrored if the parent view is using a RTL 292 // parent. The position returned is mirrored if the parent view is using a RTL
288 // layout. 293 // layout.
289 // 294 //
290 // NOTE: in the vast majority of the cases, the mirroring implementation is 295 // NOTE: in the vast majority of the cases, the mirroring implementation is
291 // transparent to the View subclasses and therefore you should use the 296 // transparent to the View subclasses and therefore you should use the
292 // bounds() accessor instead. 297 // bounds() accessor instead.
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 // RTL painting -------------------------------------------------------------- 1410 // RTL painting --------------------------------------------------------------
1406 1411
1407 // Indicates whether or not the gfx::Canvas object passed to View::Paint() 1412 // Indicates whether or not the gfx::Canvas object passed to View::Paint()
1408 // is going to be flipped horizontally (using the appropriate transform) on 1413 // is going to be flipped horizontally (using the appropriate transform) on
1409 // right-to-left locales for this View. 1414 // right-to-left locales for this View.
1410 bool flip_canvas_on_paint_for_rtl_ui_; 1415 bool flip_canvas_on_paint_for_rtl_ui_;
1411 1416
1412 // Accelerated painting ------------------------------------------------------ 1417 // Accelerated painting ------------------------------------------------------
1413 1418
1414 bool paint_to_layer_; 1419 bool paint_to_layer_;
1415 scoped_ptr<ui::Layer> layer_;
1416 1420
1417 // Accelerators -------------------------------------------------------------- 1421 // Accelerators --------------------------------------------------------------
1418 1422
1419 // true if when we were added to hierarchy we were without focus manager 1423 // true if when we were added to hierarchy we were without focus manager
1420 // attempt addition when ancestor chain changed. 1424 // attempt addition when ancestor chain changed.
1421 bool accelerator_registration_delayed_; 1425 bool accelerator_registration_delayed_;
1422 1426
1423 // Focus manager accelerators registered on. 1427 // Focus manager accelerators registered on.
1424 FocusManager* accelerator_focus_manager_; 1428 FocusManager* accelerator_focus_manager_;
1425 1429
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 base::win::ScopedComPtr<NativeViewAccessibilityWin> 1464 base::win::ScopedComPtr<NativeViewAccessibilityWin>
1461 native_view_accessibility_win_; 1465 native_view_accessibility_win_;
1462 #endif 1466 #endif
1463 1467
1464 DISALLOW_COPY_AND_ASSIGN(View); 1468 DISALLOW_COPY_AND_ASSIGN(View);
1465 }; 1469 };
1466 1470
1467 } // namespace views 1471 } // namespace views
1468 1472
1469 #endif // UI_VIEWS_VIEW_H_ 1473 #endif // UI_VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « ui/compositor/layer_owner.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698