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

Side by Side Diff: base/window_impl.cc

Issue 165188: Use base::WindowImpl instead of CWindowImpl to reduce dependencies on ATL.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <list> 5 #include <list>
6 6
7 #include "base/singleton.h" 7 #include "base/singleton.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/window_impl.h" 9 #include "base/window_impl.h"
10 #include "base/win_util.h" 10 #include "base/win_util.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (window_style_ == 0) 119 if (window_style_ == 0)
120 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle; 120 window_style_ = parent ? kWindowDefaultChildStyle : kWindowDefaultStyle;
121 121
122 // Ensures the parent we have been passed is valid, otherwise CreateWindowEx 122 // Ensures the parent we have been passed is valid, otherwise CreateWindowEx
123 // will fail. 123 // will fail.
124 if (parent && !::IsWindow(parent)) { 124 if (parent && !::IsWindow(parent)) {
125 NOTREACHED() << "invalid parent window specified."; 125 NOTREACHED() << "invalid parent window specified.";
126 parent = NULL; 126 parent = NULL;
127 } 127 }
128 128
129 int x, y, width, height;
130 if (bounds.IsEmpty()) {
131 x = y = width = height = CW_USEDEFAULT;
132 } else {
133 x = bounds.x();
134 y = bounds.y();
135 width = bounds.width();
136 height = bounds.height();
137 }
138
129 hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"", 139 hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"",
130 window_style_, bounds.x(), bounds.y(), bounds.width(), 140 window_style_, x, y, width, height,
131 bounds.height(), parent, NULL, NULL, this); 141 parent, NULL, NULL, this);
132 DCHECK(hwnd_); 142 DCHECK(hwnd_);
133 143
134 // The window procedure should have set the data for us. 144 // The window procedure should have set the data for us.
135 DCHECK(win_util::GetWindowUserData(hwnd_) == this); 145 DCHECK(win_util::GetWindowUserData(hwnd_) == this);
136 } 146 }
137 147
138 gfx::NativeView WindowImpl::GetNativeView() const { 148 gfx::NativeView WindowImpl::GetNativeView() const {
139 return hwnd_; 149 return hwnd_;
140 } 150 }
141 151
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 class_ex.hIconSm = class_ex.hIcon; 214 class_ex.hIconSm = class_ex.hIcon;
205 ATOM atom = RegisterClassEx(&class_ex); 215 ATOM atom = RegisterClassEx(&class_ex);
206 DCHECK(atom); 216 DCHECK(atom);
207 217
208 Singleton<ClassRegistrar>()->RegisterClass(class_info, name, atom); 218 Singleton<ClassRegistrar>()->RegisterClass(class_info, name, atom);
209 219
210 return name; 220 return name;
211 } 221 }
212 222
213 } // namespace base 223 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698