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/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 12 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/views/accessibility_event_router_views.h" | 14 #include "chrome/browser/ui/views/accessibility_event_router_views.h" |
15 #include "chrome/browser/ui/views/event_utils.h" | 15 #include "chrome/browser/ui/views/event_utils.h" |
16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
17 #include "ui/base/clipboard/clipboard.h" | 17 #include "ui/base/clipboard/clipboard.h" |
18 #include "ui/gfx/rect.h" | 18 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/monitor.h" |
19 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
20 #include "ui/views/widget/native_widget.h" | 21 #include "ui/views/widget/native_widget.h" |
21 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
22 | 23 |
23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
24 #include "chrome/browser/app_icon_win.h" | 25 #include "chrome/browser/app_icon_win.h" |
25 #endif | 26 #endif |
26 | 27 |
27 #if defined(USE_ASH) | 28 #if defined(USE_ASH) |
28 #include "ash/shell.h" | 29 #include "ash/shell.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 DCHECK(prefs->FindPreference(window_name.c_str())); | 67 DCHECK(prefs->FindPreference(window_name.c_str())); |
67 DictionaryPrefUpdate update(prefs, window_name.c_str()); | 68 DictionaryPrefUpdate update(prefs, window_name.c_str()); |
68 DictionaryValue* window_preferences = update.Get(); | 69 DictionaryValue* window_preferences = update.Get(); |
69 window_preferences->SetInteger("left", bounds.x()); | 70 window_preferences->SetInteger("left", bounds.x()); |
70 window_preferences->SetInteger("top", bounds.y()); | 71 window_preferences->SetInteger("top", bounds.y()); |
71 window_preferences->SetInteger("right", bounds.right()); | 72 window_preferences->SetInteger("right", bounds.right()); |
72 window_preferences->SetInteger("bottom", bounds.bottom()); | 73 window_preferences->SetInteger("bottom", bounds.bottom()); |
73 window_preferences->SetBoolean("maximized", | 74 window_preferences->SetBoolean("maximized", |
74 show_state == ui::SHOW_STATE_MAXIMIZED); | 75 show_state == ui::SHOW_STATE_MAXIMIZED); |
75 | 76 |
76 gfx::Rect work_area(gfx::Screen::GetMonitorWorkAreaMatching(bounds)); | 77 gfx::Rect work_area(gfx::Screen::GetMonitorMatching(bounds)->GetBounds()); |
77 window_preferences->SetInteger("work_area_left", work_area.x()); | 78 window_preferences->SetInteger("work_area_left", work_area.x()); |
78 window_preferences->SetInteger("work_area_top", work_area.y()); | 79 window_preferences->SetInteger("work_area_top", work_area.y()); |
79 window_preferences->SetInteger("work_area_right", work_area.right()); | 80 window_preferences->SetInteger("work_area_right", work_area.right()); |
80 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); | 81 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); |
81 } | 82 } |
82 | 83 |
83 bool ChromeViewsDelegate::GetSavedWindowPlacement( | 84 bool ChromeViewsDelegate::GetSavedWindowPlacement( |
84 const std::string& window_name, | 85 const std::string& window_name, |
85 gfx::Rect* bounds, | 86 gfx::Rect* bounds, |
86 ui::WindowShowState* show_state) const { | 87 ui::WindowShowState* show_state) const { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 g_browser_process->AddRefModule(); | 151 g_browser_process->AddRefModule(); |
151 } | 152 } |
152 | 153 |
153 void ChromeViewsDelegate::ReleaseRef() { | 154 void ChromeViewsDelegate::ReleaseRef() { |
154 g_browser_process->ReleaseModule(); | 155 g_browser_process->ReleaseModule(); |
155 } | 156 } |
156 | 157 |
157 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { | 158 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { |
158 return event_utils::DispositionFromEventFlags(event_flags); | 159 return event_utils::DispositionFromEventFlags(event_flags); |
159 } | 160 } |
OLD | NEW |