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

Unified Diff: chrome/browser/ui/window_sizer.cc

Issue 8585035: Use scoped_ptr for memory management rather than calling delete through WindowSizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/window_sizer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/window_sizer.cc
diff --git a/chrome/browser/ui/window_sizer.cc b/chrome/browser/ui/window_sizer.cc
index 9a8d7f35419740a25135485266f50a3ba93667cb..228e4a1c22ef14b1e76d7a2df003652ee6a49dd4 100644
--- a/chrome/browser/ui/window_sizer.cc
+++ b/chrome/browser/ui/window_sizer.cc
@@ -102,18 +102,13 @@ class DefaultStateProvider : public WindowSizer::StateProvider {
///////////////////////////////////////////////////////////////////////////////
// WindowSizer, public:
-WindowSizer::WindowSizer(
- StateProvider* state_provider,
- MonitorInfoProvider* monitor_info_provider)
+WindowSizer::WindowSizer(StateProvider* state_provider,
+ MonitorInfoProvider* monitor_info_provider)
: state_provider_(state_provider),
monitor_info_provider_(monitor_info_provider) {
}
WindowSizer::~WindowSizer() {
- if (state_provider_)
- delete state_provider_;
- if (monitor_info_provider_)
- delete monitor_info_provider_;
}
// static
@@ -146,7 +141,8 @@ void WindowSizer::DetermineWindowBounds(const gfx::Rect& specified_bounds,
bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds) const {
DCHECK(bounds);
- if (!state_provider_ || !state_provider_->GetLastActiveWindowState(bounds))
+ if (!state_provider_.get() ||
+ !state_provider_->GetLastActiveWindowState(bounds))
return false;
gfx::Rect last_window_bounds = *bounds;
bounds->Offset(kWindowTilePixels, kWindowTilePixels);
@@ -159,7 +155,7 @@ bool WindowSizer::GetLastWindowBounds(gfx::Rect* bounds) const {
bool WindowSizer::GetSavedWindowBounds(gfx::Rect* bounds) const {
DCHECK(bounds);
gfx::Rect saved_work_area;
- if (!state_provider_ ||
+ if (!state_provider_.get() ||
!state_provider_->GetPersistentState(bounds, &saved_work_area))
return false;
AdjustBoundsToBeVisibleOnMonitorContaining(*bounds, saved_work_area, bounds);
@@ -168,7 +164,7 @@ bool WindowSizer::GetSavedWindowBounds(gfx::Rect* bounds) const {
void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const {
DCHECK(default_bounds);
- DCHECK(monitor_info_provider_);
+ DCHECK(monitor_info_provider_.get());
gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea();
@@ -201,7 +197,7 @@ void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const {
}
bool WindowSizer::PositionIsOffscreen(int position, Edge edge) const {
- DCHECK(monitor_info_provider_);
+ DCHECK(monitor_info_provider_.get());
size_t monitor_count = monitor_info_provider_->GetMonitorCount();
for (size_t i = 0; i < monitor_count; ++i) {
gfx::Rect work_area = monitor_info_provider_->GetWorkAreaAt(i);
@@ -239,7 +235,7 @@ void WindowSizer::AdjustBoundsToBeVisibleOnMonitorContaining(
const gfx::Rect& saved_work_area,
gfx::Rect* bounds) const {
DCHECK(bounds);
- DCHECK(monitor_info_provider_);
+ DCHECK(monitor_info_provider_.get());
// Find the size of the work area of the monitor that intersects the bounds
// of the anchor window.
« no previous file with comments | « chrome/browser/ui/window_sizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698