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

Side by Side Diff: extensions/shell/browser/shell_desktop_controller.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/shell/browser/shell_desktop_controller.h" 5 #include "extensions/shell/browser/shell_desktop_controller.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 return true; 153 return true;
154 } 154 }
155 155
156 private: 156 private:
157 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules); 157 DISALLOW_COPY_AND_ASSIGN(AppsFocusRules);
158 }; 158 };
159 159
160 } // namespace 160 } // namespace
161 161
162 ShellDesktopController::ShellDesktopController() 162 ShellDesktopController::ShellDesktopController()
163 : app_window_client_(new ShellAppWindowClient), app_window_(NULL) { 163 : app_window_client_(new ShellAppWindowClient), app_window_(nullptr) {
164 extensions::AppWindowClient::Set(app_window_client_.get()); 164 extensions::AppWindowClient::Set(app_window_client_.get());
165 165
166 #if defined(OS_CHROMEOS) 166 #if defined(OS_CHROMEOS)
167 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 167 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
168 AddObserver(this); 168 AddObserver(this);
169 display_configurator_.reset(new ui::DisplayConfigurator); 169 display_configurator_.reset(new ui::DisplayConfigurator);
170 display_configurator_->Init(false); 170 display_configurator_->Init(false);
171 display_configurator_->ForceInitialConfigure(0); 171 display_configurator_->ForceInitialConfigure(0);
172 display_configurator_->AddObserver(this); 172 display_configurator_->AddObserver(this);
173 #endif 173 #endif
174 CreateRootWindow(); 174 CreateRootWindow();
175 } 175 }
176 176
177 ShellDesktopController::~ShellDesktopController() { 177 ShellDesktopController::~ShellDesktopController() {
178 CloseAppWindows(); 178 CloseAppWindows();
179 DestroyRootWindow(); 179 DestroyRootWindow();
180 #if defined(OS_CHROMEOS) 180 #if defined(OS_CHROMEOS)
181 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> 181 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
182 RemoveObserver(this); 182 RemoveObserver(this);
183 #endif 183 #endif
184 extensions::AppWindowClient::Set(NULL); 184 extensions::AppWindowClient::Set(nullptr);
185 } 185 }
186 186
187 aura::WindowTreeHost* ShellDesktopController::GetHost() { 187 aura::WindowTreeHost* ShellDesktopController::GetHost() {
188 return host_.get(); 188 return host_.get();
189 } 189 }
190 190
191 AppWindow* ShellDesktopController::CreateAppWindow( 191 AppWindow* ShellDesktopController::CreateAppWindow(
192 content::BrowserContext* context, 192 content::BrowserContext* context,
193 const Extension* extension) { 193 const Extension* extension) {
194 app_window_ = new AppWindow(context, new ShellAppDelegate, extension); 194 app_window_ = new AppWindow(context, new ShellAppDelegate, extension);
195 return app_window_; 195 return app_window_;
196 } 196 }
197 197
198 void ShellDesktopController::AddAppWindow(aura::Window* window) { 198 void ShellDesktopController::AddAppWindow(aura::Window* window) {
199 aura::Window* root_window = GetHost()->window(); 199 aura::Window* root_window = GetHost()->window();
200 root_window->AddChild(window); 200 root_window->AddChild(window);
201 } 201 }
202 202
203 void ShellDesktopController::CloseAppWindows() { 203 void ShellDesktopController::CloseAppWindows() {
204 if (app_window_) { 204 if (app_window_) {
205 app_window_->GetBaseWindow()->Close(); // Close() deletes |app_window_|. 205 app_window_->GetBaseWindow()->Close(); // Close() deletes |app_window_|.
206 app_window_ = NULL; 206 app_window_ = nullptr;
207 } 207 }
208 } 208 }
209 209
210 aura::Window* ShellDesktopController::GetDefaultParent( 210 aura::Window* ShellDesktopController::GetDefaultParent(
211 aura::Window* context, 211 aura::Window* context,
212 aura::Window* window, 212 aura::Window* window,
213 const gfx::Rect& bounds) { 213 const gfx::Rect& bounds) {
214 return host_->window(); 214 return host_->window();
215 } 215 }
216 216
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 if (input_method_filter_) 315 if (input_method_filter_)
316 root_window_event_filter_->RemoveHandler(input_method_filter_.get()); 316 root_window_event_filter_->RemoveHandler(input_method_filter_.get());
317 if (user_activity_detector_) { 317 if (user_activity_detector_) {
318 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( 318 host_->event_processor()->GetRootTarget()->RemovePreTargetHandler(
319 user_activity_detector_.get()); 319 user_activity_detector_.get());
320 } 320 }
321 wm::FocusController* focus_controller = 321 wm::FocusController* focus_controller =
322 static_cast<wm::FocusController*>(focus_client_.get()); 322 static_cast<wm::FocusController*>(focus_client_.get());
323 if (focus_controller) { 323 if (focus_controller) {
324 host_->window()->RemovePreTargetHandler(focus_controller); 324 host_->window()->RemovePreTargetHandler(focus_controller);
325 aura::client::SetActivationClient(host_->window(), NULL); 325 aura::client::SetActivationClient(host_->window(), nullptr);
326 } 326 }
327 root_window_event_filter_.reset(); 327 root_window_event_filter_.reset();
328 capture_client_.reset(); 328 capture_client_.reset();
329 input_method_filter_.reset(); 329 input_method_filter_.reset();
330 focus_client_.reset(); 330 focus_client_.reset();
331 cursor_manager_.reset(); 331 cursor_manager_.reset();
332 #if defined(OS_CHROMEOS) 332 #if defined(OS_CHROMEOS)
333 user_activity_notifier_.reset(); 333 user_activity_notifier_.reset();
334 #endif 334 #endif
335 user_activity_detector_.reset(); 335 user_activity_detector_.reset();
336 host_.reset(); 336 host_.reset();
337 } 337 }
338 338
339 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { 339 gfx::Size ShellDesktopController::GetPrimaryDisplaySize() {
340 #if defined(OS_CHROMEOS) 340 #if defined(OS_CHROMEOS)
341 const std::vector<ui::DisplayConfigurator::DisplayState>& displays = 341 const std::vector<ui::DisplayConfigurator::DisplayState>& displays =
342 display_configurator_->cached_displays(); 342 display_configurator_->cached_displays();
343 if (displays.empty()) 343 if (displays.empty())
344 return gfx::Size(); 344 return gfx::Size();
345 const ui::DisplayMode* mode = displays[0].display->current_mode(); 345 const ui::DisplayMode* mode = displays[0].display->current_mode();
346 return mode ? mode->size() : gfx::Size(); 346 return mode ? mode->size() : gfx::Size();
347 #else 347 #else
348 return gfx::Size(); 348 return gfx::Size();
349 #endif 349 #endif
350 } 350 }
351 351
352 } // namespace extensions 352 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698