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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate_win.cc

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Use 'related control spacing' constant for icon-to-text spacing Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "chrome/browser/ui/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 edges |= views::ViewsDelegate::EDGE_LEFT; 97 edges |= views::ViewsDelegate::EDGE_LEFT;
98 if (MonitorHasAutohideTaskbarForEdge(ABE_TOP, monitor)) 98 if (MonitorHasAutohideTaskbarForEdge(ABE_TOP, monitor))
99 edges |= views::ViewsDelegate::EDGE_TOP; 99 edges |= views::ViewsDelegate::EDGE_TOP;
100 if (MonitorHasAutohideTaskbarForEdge(ABE_RIGHT, monitor)) 100 if (MonitorHasAutohideTaskbarForEdge(ABE_RIGHT, monitor))
101 edges |= views::ViewsDelegate::EDGE_RIGHT; 101 edges |= views::ViewsDelegate::EDGE_RIGHT;
102 if (MonitorHasAutohideTaskbarForEdge(ABE_BOTTOM, monitor)) 102 if (MonitorHasAutohideTaskbarForEdge(ABE_BOTTOM, monitor))
103 edges |= views::ViewsDelegate::EDGE_BOTTOM; 103 edges |= views::ViewsDelegate::EDGE_BOTTOM;
104 return edges; 104 return edges;
105 } 105 }
106 106
107 ChromeViewsDelegate* views_delegate = nullptr;
108
107 } // namespace 109 } // namespace
108 110
109 ChromeViewsDelegate::ChromeViewsDelegate() 111 ChromeViewsDelegate::ChromeViewsDelegate()
110 : in_autohide_edges_callback_(false), weak_factory_(this) {} 112 : in_autohide_edges_callback_(false), weak_factory_(this) {
Peter Kasting 2017/03/09 05:52:11 For this function, it looks like the only reason i
kylix_rd 2017/03/09 15:02:31 Can weak_factory_ be initialized with "this" using
Peter Kasting 2017/03/09 18:26:48 It should be able to, AFAIK. Such initializers ar
kylix_rd 2017/03/10 15:10:40 weak_factory_ takes "this" as a constructor parame
Peter Kasting 2017/03/10 20:44:54 Oh, due to the constructor being marked explicit?
113 DCHECK(!views_delegate);
114 views_delegate = this;
115 }
116
117 ChromeViewsDelegate::~ChromeViewsDelegate() {
Peter Kasting 2017/03/09 05:52:11 For these two functions, the implementations look
kylix_rd 2017/03/09 15:02:31 Since views_delegate is also defined in chrome_vie
118 DCHECK_EQ(0u, ref_count_);
119
120 DCHECK_EQ(this, views_delegate);
121 views_delegate = nullptr;
122 }
123
124 ChromeViewsDelegate* ChromeViewsDelegate::GetInstance() {
125 return views_delegate;
126 }
111 127
112 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const { 128 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
113 return GetAppIcon(); 129 return GetAppIcon();
114 } 130 }
115 131
116 HICON ChromeViewsDelegate::GetSmallWindowIcon() const { 132 HICON ChromeViewsDelegate::GetSmallWindowIcon() const {
117 return GetSmallAppIcon(); 133 return GetSmallAppIcon();
118 } 134 }
119 135
120 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( 136 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget(
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 HMONITOR monitor, 202 HMONITOR monitor,
187 int returned_edges, 203 int returned_edges,
188 int edges) { 204 int edges) {
189 appbar_autohide_edge_map_[monitor] = edges; 205 appbar_autohide_edge_map_[monitor] = edges;
190 if (returned_edges == edges) 206 if (returned_edges == edges)
191 return; 207 return;
192 208
193 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); 209 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true);
194 callback.Run(); 210 callback.Run();
195 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698