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

Side by Side Diff: ui/views/widget/widget_delegate.cc

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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
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 #include "ui/views/widget/widget_delegate.h" 5 #include "ui/views/widget/widget_delegate.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/gfx/image/image_skia.h" 8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/bubble/bubble_delegate.h" 9 #include "ui/views/bubble/bubble_delegate.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return false; 109 return false;
110 } 110 }
111 111
112 std::string WidgetDelegate::GetWindowName() const { 112 std::string WidgetDelegate::GetWindowName() const {
113 return std::string(); 113 return std::string();
114 } 114 }
115 115
116 void WidgetDelegate::SaveWindowPlacement(const gfx::Rect& bounds, 116 void WidgetDelegate::SaveWindowPlacement(const gfx::Rect& bounds,
117 ui::WindowShowState show_state) { 117 ui::WindowShowState show_state) {
118 std::string window_name = GetWindowName(); 118 std::string window_name = GetWindowName();
119 if (!ViewsDelegate::views_delegate || window_name.empty()) 119 if (!ViewsDelegate::GetInstance() || window_name.empty())
120 return; 120 return;
121 121
122 ViewsDelegate::views_delegate->SaveWindowPlacement( 122 ViewsDelegate::GetInstance()->SaveWindowPlacement(GetWidget(), window_name,
123 GetWidget(), window_name, bounds, show_state); 123 bounds, show_state);
124 } 124 }
125 125
126 bool WidgetDelegate::GetSavedWindowPlacement( 126 bool WidgetDelegate::GetSavedWindowPlacement(
127 const Widget* widget, 127 const Widget* widget,
128 gfx::Rect* bounds, 128 gfx::Rect* bounds,
129 ui::WindowShowState* show_state) const { 129 ui::WindowShowState* show_state) const {
130 std::string window_name = GetWindowName(); 130 std::string window_name = GetWindowName();
131 if (!ViewsDelegate::views_delegate || window_name.empty()) 131 if (!ViewsDelegate::GetInstance() || window_name.empty())
132 return false; 132 return false;
133 133
134 return ViewsDelegate::views_delegate->GetSavedWindowPlacement( 134 return ViewsDelegate::GetInstance()->GetSavedWindowPlacement(
135 widget, window_name, bounds, show_state); 135 widget, window_name, bounds, show_state);
136 } 136 }
137 137
138 bool WidgetDelegate::ShouldRestoreWindowSize() const { 138 bool WidgetDelegate::ShouldRestoreWindowSize() const {
139 return true; 139 return true;
140 } 140 }
141 141
142 View* WidgetDelegate::GetContentsView() { 142 View* WidgetDelegate::GetContentsView() {
143 if (!default_contents_view_) 143 if (!default_contents_view_)
144 default_contents_view_ = new View; 144 default_contents_view_ = new View;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 const Widget* WidgetDelegateView::GetWidget() const { 204 const Widget* WidgetDelegateView::GetWidget() const {
205 return View::GetWidget(); 205 return View::GetWidget();
206 } 206 }
207 207
208 const char* WidgetDelegateView::GetClassName() const { 208 const char* WidgetDelegateView::GetClassName() const {
209 return kViewClassName; 209 return kViewClassName;
210 } 210 }
211 211
212 } // namespace views 212 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698