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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/chrome_views_delegate_win.cc
diff --git a/chrome/browser/ui/views/chrome_views_delegate_win.cc b/chrome/browser/ui/views/chrome_views_delegate_win.cc
index 342e1391cac54a2b465e5cd0a15ff5c5bb3c0b04..475bede05671fadfe664cec16993512238ca9b2b 100644
--- a/chrome/browser/ui/views/chrome_views_delegate_win.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate_win.cc
@@ -104,10 +104,26 @@ int GetAppbarAutohideEdgesOnWorkerThread(HMONITOR monitor) {
return edges;
}
+ChromeViewsDelegate* views_delegate = nullptr;
+
} // namespace
ChromeViewsDelegate::ChromeViewsDelegate()
- : in_autohide_edges_callback_(false), weak_factory_(this) {}
+ : 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?
+ DCHECK(!views_delegate);
+ views_delegate = this;
+}
+
+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
+ DCHECK_EQ(0u, ref_count_);
+
+ DCHECK_EQ(this, views_delegate);
+ views_delegate = nullptr;
+}
+
+ChromeViewsDelegate* ChromeViewsDelegate::GetInstance() {
+ return views_delegate;
+}
HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
return GetAppIcon();

Powered by Google App Engine
This is Rietveld 408576698