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

Side by Side Diff: views/widget/widget.h

Issue 8240006: Use a mocked compositor for unit tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 2 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_WIDGET_WIDGET_H_ 5 #ifndef VIEWS_WIDGET_WIDGET_H_
6 #define VIEWS_WIDGET_WIDGET_H_ 6 #define VIEWS_WIDGET_WIDGET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <stack> 9 #include <stack>
10 10
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 ClientView* client_view() { 490 ClientView* client_view() {
491 return const_cast<ClientView*>( 491 return const_cast<ClientView*>(
492 const_cast<const Widget*>(this)->client_view()); 492 const_cast<const Widget*>(this)->client_view());
493 } 493 }
494 const ClientView* client_view() const { 494 const ClientView* client_view() const {
495 // non_client_view_ may be NULL, especially during creation. 495 // non_client_view_ may be NULL, especially during creation.
496 return non_client_view_ ? non_client_view_->client_view() : NULL; 496 return non_client_view_ ? non_client_view_->client_view() : NULL;
497 } 497 }
498 498
499 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) {
500 compositor_factory_ = factory;
501 }
502 static ui::Compositor* (*compositor_factory())() {
503 return compositor_factory_;
504 }
505
506 const ui::Compositor* GetCompositor() const; 499 const ui::Compositor* GetCompositor() const;
507 ui::Compositor* GetCompositor(); 500 ui::Compositor* GetCompositor();
508 501
509 // Invokes method of same name on the NativeWidget. 502 // Invokes method of same name on the NativeWidget.
510 void CalculateOffsetToAncestorWithLayer(gfx::Point* offset, 503 void CalculateOffsetToAncestorWithLayer(gfx::Point* offset,
511 ui::Layer** layer_parent); 504 ui::Layer** layer_parent);
512 505
513 // Invokes method of same name on the NativeWidget. 506 // Invokes method of same name on the NativeWidget.
514 void ReorderLayers(); 507 void ReorderLayers();
515 508
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 // Focus is automatically set to the view provided by the delegate 708 // Focus is automatically set to the view provided by the delegate
716 // when the widget is shown. Set this value to false to override 709 // when the widget is shown. Set this value to false to override
717 // initial focus for the widget. 710 // initial focus for the widget.
718 bool focus_on_creation_; 711 bool focus_on_creation_;
719 712
720 scoped_ptr<InputMethod> input_method_; 713 scoped_ptr<InputMethod> input_method_;
721 714
722 // See |is_top_level()| accessor. 715 // See |is_top_level()| accessor.
723 bool is_top_level_; 716 bool is_top_level_;
724 717
725 // Factory used to create Compositors. Settable by tests.
726 static ui::Compositor*(*compositor_factory_)();
727
728 // Tracks whether native widget has been initialized. 718 // Tracks whether native widget has been initialized.
729 bool native_widget_initialized_; 719 bool native_widget_initialized_;
730 720
731 // TODO(beng): Remove NativeWidgetGtk's dependence on these: 721 // TODO(beng): Remove NativeWidgetGtk's dependence on these:
732 // If true, the mouse is currently down. 722 // If true, the mouse is currently down.
733 bool is_mouse_button_pressed_; 723 bool is_mouse_button_pressed_;
734 724
735 // TODO(beng): Remove NativeWidgetGtk's dependence on these: 725 // TODO(beng): Remove NativeWidgetGtk's dependence on these:
736 // The following are used to detect duplicate mouse move events and not 726 // The following are used to detect duplicate mouse move events and not
737 // deliver them. Displaying a window may result in the system generating 727 // deliver them. Displaying a window may result in the system generating
738 // duplicate move events even though the mouse hasn't moved. 728 // duplicate move events even though the mouse hasn't moved.
739 bool last_mouse_event_was_move_; 729 bool last_mouse_event_was_move_;
740 gfx::Point last_mouse_event_position_; 730 gfx::Point last_mouse_event_position_;
741 731
742 DISALLOW_COPY_AND_ASSIGN(Widget); 732 DISALLOW_COPY_AND_ASSIGN(Widget);
743 }; 733 };
744 734
745 } // namespace views 735 } // namespace views
746 736
747 #endif // VIEWS_WIDGET_WIDGET_H_ 737 #endif // VIEWS_WIDGET_WIDGET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698