OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/monitor_info_provider.h" |
14 #include "chrome/browser/ui/views/accessibility_event_router_views.h" | 15 #include "chrome/browser/ui/views/accessibility_event_router_views.h" |
15 #include "chrome/browser/ui/views/event_utils.h" | 16 #include "chrome/browser/ui/views/event_utils.h" |
16 #include "chrome/browser/ui/window_sizer.h" | |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 #include "ui/views/widget/native_widget.h" | 20 #include "ui/views/widget/native_widget.h" |
21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
22 | 22 |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 #include "chrome/browser/app_icon_win.h" | 24 #include "chrome/browser/app_icon_win.h" |
25 #endif | 25 #endif |
26 | 26 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DCHECK(prefs->FindPreference(window_name.c_str())); | 62 DCHECK(prefs->FindPreference(window_name.c_str())); |
63 DictionaryPrefUpdate update(prefs, window_name.c_str()); | 63 DictionaryPrefUpdate update(prefs, window_name.c_str()); |
64 DictionaryValue* window_preferences = update.Get(); | 64 DictionaryValue* window_preferences = update.Get(); |
65 window_preferences->SetInteger("left", bounds.x()); | 65 window_preferences->SetInteger("left", bounds.x()); |
66 window_preferences->SetInteger("top", bounds.y()); | 66 window_preferences->SetInteger("top", bounds.y()); |
67 window_preferences->SetInteger("right", bounds.right()); | 67 window_preferences->SetInteger("right", bounds.right()); |
68 window_preferences->SetInteger("bottom", bounds.bottom()); | 68 window_preferences->SetInteger("bottom", bounds.bottom()); |
69 window_preferences->SetBoolean("maximized", | 69 window_preferences->SetBoolean("maximized", |
70 show_state == ui::SHOW_STATE_MAXIMIZED); | 70 show_state == ui::SHOW_STATE_MAXIMIZED); |
71 | 71 |
72 scoped_ptr<WindowSizer::MonitorInfoProvider> monitor_info_provider( | 72 scoped_ptr<MonitorInfoProvider> monitor_info(MonitorInfoProvider::Create()); |
73 WindowSizer::CreateDefaultMonitorInfoProvider()); | |
74 gfx::Rect work_area( | 73 gfx::Rect work_area( |
75 monitor_info_provider->GetMonitorWorkAreaMatching(bounds)); | 74 monitor_info->GetMonitorWorkAreaMatching(bounds)); |
76 window_preferences->SetInteger("work_area_left", work_area.x()); | 75 window_preferences->SetInteger("work_area_left", work_area.x()); |
77 window_preferences->SetInteger("work_area_top", work_area.y()); | 76 window_preferences->SetInteger("work_area_top", work_area.y()); |
78 window_preferences->SetInteger("work_area_right", work_area.right()); | 77 window_preferences->SetInteger("work_area_right", work_area.right()); |
79 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); | 78 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); |
80 } | 79 } |
81 | 80 |
82 bool ChromeViewsDelegate::GetSavedWindowPlacement( | 81 bool ChromeViewsDelegate::GetSavedWindowPlacement( |
83 const std::string& window_name, | 82 const std::string& window_name, |
84 gfx::Rect* bounds, | 83 gfx::Rect* bounds, |
85 ui::WindowShowState* show_state) const { | 84 ui::WindowShowState* show_state) const { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 g_browser_process->AddRefModule(); | 130 g_browser_process->AddRefModule(); |
132 } | 131 } |
133 | 132 |
134 void ChromeViewsDelegate::ReleaseRef() { | 133 void ChromeViewsDelegate::ReleaseRef() { |
135 g_browser_process->ReleaseModule(); | 134 g_browser_process->ReleaseModule(); |
136 } | 135 } |
137 | 136 |
138 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { | 137 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { |
139 return event_utils::DispositionFromEventFlags(event_flags); | 138 return event_utils::DispositionFromEventFlags(event_flags); |
140 } | 139 } |
OLD | NEW |