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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_dialog.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 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 "chrome/browser/ui/views/extensions/extension_dialog.h" 5 #include "chrome/browser/ui/views/extensions/extension_dialog.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/base_window.h" 10 #include "chrome/browser/ui/base_window.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 // Center the window over the browser. 161 // Center the window over the browser.
162 gfx::Point center = base_window->GetBounds().CenterPoint(); 162 gfx::Point center = base_window->GetBounds().CenterPoint();
163 int x = center.x() - width / 2; 163 int x = center.x() - width / 2;
164 int y = center.y() - height / 2; 164 int y = center.y() - height / 2;
165 // Ensure the top left and top right of the window are on screen, with 165 // Ensure the top left and top right of the window are on screen, with
166 // priority given to the top left. 166 // priority given to the top left.
167 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)-> 167 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)->
168 GetDisplayNearestPoint(center).bounds(); 168 GetDisplayNearestPoint(center).bounds();
169 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); 169 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height);
170 bounds_rect = bounds_rect.AdjustToFit(screen_rect); 170 bounds_rect.AdjustToFit(screen_rect);
171 window_->SetBounds(bounds_rect); 171 window_->SetBounds(bounds_rect);
172 172
173 window_->Show(); 173 window_->Show();
174 // TODO(jamescook): Remove redundant call to Activate()? 174 // TODO(jamescook): Remove redundant call to Activate()?
175 window_->Activate(); 175 window_->Activate();
176 } 176 }
177 177
178 void ExtensionDialog::ObserverDestroyed() { 178 void ExtensionDialog::ObserverDestroyed() {
179 observer_ = NULL; 179 observer_ = NULL;
180 } 180 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (content::Details<extensions::ExtensionHost>(host()) != details) 279 if (content::Details<extensions::ExtensionHost>(host()) != details)
280 return; 280 return;
281 if (observer_) 281 if (observer_)
282 observer_->ExtensionTerminated(this); 282 observer_->ExtensionTerminated(this);
283 break; 283 break;
284 default: 284 default:
285 NOTREACHED() << L"Received unexpected notification"; 285 NOTREACHED() << L"Received unexpected notification";
286 break; 286 break;
287 } 287 }
288 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698