| OLD | NEW |
| 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/chrome_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 scoped_ptr<DictionaryPrefUpdate> pref_update = | 188 scoped_ptr<DictionaryPrefUpdate> pref_update = |
| 189 chrome::GetWindowPlacementDictionaryReadWrite(window_name, prefs); | 189 chrome::GetWindowPlacementDictionaryReadWrite(window_name, prefs); |
| 190 base::DictionaryValue* window_preferences = pref_update->Get(); | 190 base::DictionaryValue* window_preferences = pref_update->Get(); |
| 191 window_preferences->SetInteger("left", bounds.x()); | 191 window_preferences->SetInteger("left", bounds.x()); |
| 192 window_preferences->SetInteger("top", bounds.y()); | 192 window_preferences->SetInteger("top", bounds.y()); |
| 193 window_preferences->SetInteger("right", bounds.right()); | 193 window_preferences->SetInteger("right", bounds.right()); |
| 194 window_preferences->SetInteger("bottom", bounds.bottom()); | 194 window_preferences->SetInteger("bottom", bounds.bottom()); |
| 195 window_preferences->SetBoolean("maximized", | 195 window_preferences->SetBoolean("maximized", |
| 196 show_state == ui::SHOW_STATE_MAXIMIZED); | 196 show_state == ui::SHOW_STATE_MAXIMIZED); |
| 197 window_preferences->SetBoolean("docked", show_state == ui::SHOW_STATE_DOCKED); | 197 window_preferences->SetBoolean("docked", show_state == ui::SHOW_STATE_DOCKED); |
| 198 gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())-> | 198 gfx::Rect work_area(gfx::Screen::GetScreen() |
| 199 GetDisplayNearestWindow(window->GetNativeView()).work_area()); | 199 ->GetDisplayNearestWindow(window->GetNativeView()) |
| 200 .work_area()); |
| 200 window_preferences->SetInteger("work_area_left", work_area.x()); | 201 window_preferences->SetInteger("work_area_left", work_area.x()); |
| 201 window_preferences->SetInteger("work_area_top", work_area.y()); | 202 window_preferences->SetInteger("work_area_top", work_area.y()); |
| 202 window_preferences->SetInteger("work_area_right", work_area.right()); | 203 window_preferences->SetInteger("work_area_right", work_area.right()); |
| 203 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); | 204 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); |
| 204 } | 205 } |
| 205 | 206 |
| 206 bool ChromeViewsDelegate::GetSavedWindowPlacement( | 207 bool ChromeViewsDelegate::GetSavedWindowPlacement( |
| 207 const views::Widget* widget, | 208 const views::Widget* widget, |
| 208 const std::string& window_name, | 209 const std::string& window_name, |
| 209 gfx::Rect* bounds, | 210 gfx::Rect* bounds, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 230 if (dictionary) | 231 if (dictionary) |
| 231 dictionary->GetBoolean("maximized", &maximized); | 232 dictionary->GetBoolean("maximized", &maximized); |
| 232 *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; | 233 *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; |
| 233 | 234 |
| 234 #if defined(USE_ASH) | 235 #if defined(USE_ASH) |
| 235 // On Ash environment, a window won't span across displays. Adjust | 236 // On Ash environment, a window won't span across displays. Adjust |
| 236 // the bounds to fit the work area. | 237 // the bounds to fit the work area. |
| 237 gfx::NativeView window = widget->GetNativeView(); | 238 gfx::NativeView window = widget->GetNativeView(); |
| 238 if (chrome::GetHostDesktopTypeForNativeView(window) == | 239 if (chrome::GetHostDesktopTypeForNativeView(window) == |
| 239 chrome::HOST_DESKTOP_TYPE_ASH) { | 240 chrome::HOST_DESKTOP_TYPE_ASH) { |
| 240 gfx::Display display = gfx::Screen::GetScreenFor(window)-> | 241 gfx::Display display = |
| 241 GetDisplayMatching(*bounds); | 242 gfx::Screen::GetScreen()->GetDisplayMatching(*bounds); |
| 242 bounds->AdjustToFit(display.work_area()); | 243 bounds->AdjustToFit(display.work_area()); |
| 243 ash::wm::GetWindowState(window)->set_minimum_visibility(true); | 244 ash::wm::GetWindowState(window)->set_minimum_visibility(true); |
| 244 } | 245 } |
| 245 #endif | 246 #endif |
| 246 return true; | 247 return true; |
| 247 } | 248 } |
| 248 | 249 |
| 249 void ChromeViewsDelegate::NotifyAccessibilityEvent( | 250 void ChromeViewsDelegate::NotifyAccessibilityEvent( |
| 250 views::View* view, ui::AXEvent event_type) { | 251 views::View* view, ui::AXEvent event_type) { |
| 251 #if defined(USE_AURA) | 252 #if defined(USE_AURA) |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 return content::BrowserThread::GetBlockingPool(); | 510 return content::BrowserThread::GetBlockingPool(); |
| 510 } | 511 } |
| 511 | 512 |
| 512 #if !defined(USE_ASH) | 513 #if !defined(USE_ASH) |
| 513 views::Widget::InitParams::WindowOpacity | 514 views::Widget::InitParams::WindowOpacity |
| 514 ChromeViewsDelegate::GetOpacityForInitParams( | 515 ChromeViewsDelegate::GetOpacityForInitParams( |
| 515 const views::Widget::InitParams& params) { | 516 const views::Widget::InitParams& params) { |
| 516 return views::Widget::InitParams::OPAQUE_WINDOW; | 517 return views::Widget::InitParams::OPAQUE_WINDOW; |
| 517 } | 518 } |
| 518 #endif | 519 #endif |
| OLD | NEW |