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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix other os's 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 | Annotate | Revision Log
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/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DCHECK(prefs->FindPreference(window_name.c_str())); 72 DCHECK(prefs->FindPreference(window_name.c_str()));
73 DictionaryPrefUpdate update(prefs, window_name.c_str()); 73 DictionaryPrefUpdate update(prefs, window_name.c_str());
74 DictionaryValue* window_preferences = update.Get(); 74 DictionaryValue* window_preferences = update.Get();
75 window_preferences->SetInteger("left", bounds.x()); 75 window_preferences->SetInteger("left", bounds.x());
76 window_preferences->SetInteger("top", bounds.y()); 76 window_preferences->SetInteger("top", bounds.y());
77 window_preferences->SetInteger("right", bounds.right()); 77 window_preferences->SetInteger("right", bounds.right());
78 window_preferences->SetInteger("bottom", bounds.bottom()); 78 window_preferences->SetInteger("bottom", bounds.bottom());
79 window_preferences->SetBoolean("maximized", 79 window_preferences->SetBoolean("maximized",
80 show_state == ui::SHOW_STATE_MAXIMIZED); 80 show_state == ui::SHOW_STATE_MAXIMIZED);
81 gfx::Rect work_area( 81 gfx::Rect work_area(
82 gfx::Screen::GetDisplayMatching(bounds).work_area()); 82 gfx::Screen::GetDisplayMatching(
83 gfx::Screen::BadTwoWorldsContext(), bounds).work_area());
oshima 2012/10/04 20:18:26 shouldn't this be |window|?
83 window_preferences->SetInteger("work_area_left", work_area.x()); 84 window_preferences->SetInteger("work_area_left", work_area.x());
84 window_preferences->SetInteger("work_area_top", work_area.y()); 85 window_preferences->SetInteger("work_area_top", work_area.y());
85 window_preferences->SetInteger("work_area_right", work_area.right()); 86 window_preferences->SetInteger("work_area_right", work_area.right());
86 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); 87 window_preferences->SetInteger("work_area_bottom", work_area.bottom());
87 } 88 }
88 89
89 bool ChromeViewsDelegate::GetSavedWindowPlacement( 90 bool ChromeViewsDelegate::GetSavedWindowPlacement(
90 const std::string& window_name, 91 const std::string& window_name,
91 gfx::Rect* bounds, 92 gfx::Rect* bounds,
92 ui::WindowShowState* show_state) const { 93 ui::WindowShowState* show_state) const {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void ChromeViewsDelegate::ReleaseRef() { 161 void ChromeViewsDelegate::ReleaseRef() {
161 g_browser_process->ReleaseModule(); 162 g_browser_process->ReleaseModule();
162 } 163 }
163 164
164 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { 165 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) {
165 return chrome::DispositionFromEventFlags(event_flags); 166 return chrome::DispositionFromEventFlags(event_flags);
166 } 167 }
167 168
168 #if defined(USE_AURA) 169 #if defined(USE_AURA)
169 views::NativeWidgetHelperAura* ChromeViewsDelegate::CreateNativeWidgetHelper( 170 views::NativeWidgetHelperAura* ChromeViewsDelegate::CreateNativeWidgetHelper(
170 views::NativeWidgetAura* native_widget) { 171 views::NativeWidgetAura* native_widget, gfx::NativeView parent) {
171 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312 172 // TODO(beng): insufficient but currently necessary. http://crbug.com/133312
172 #if !defined(OS_CHROMEOS) // We don't build this class for ChromeOS. 173 #if !defined(OS_CHROMEOS) // We don't build this class for ChromeOS.
173 #if defined(USE_ASH) 174 #if defined(USE_ASH)
174 if (!chrome::ShouldOpenAshOnStartup()) 175 if (!chrome::ShouldOpenAshOnStartup())
175 #endif 176 #endif
176 return new views::DesktopNativeWidgetHelperAura(native_widget); 177 return new views::DesktopNativeWidgetHelperAura(native_widget);
177 #endif 178 #endif
178 #if defined(USE_ASH) 179 #if defined(USE_ASH)
179 return NULL; 180 return NULL;
180 #endif 181 #endif
181 } 182 }
182 #endif 183 #endif
183 184
184 content::WebContents* ChromeViewsDelegate::CreateWebContents( 185 content::WebContents* ChromeViewsDelegate::CreateWebContents(
185 content::BrowserContext* browser_context, 186 content::BrowserContext* browser_context,
186 content::SiteInstance* site_instance) { 187 content::SiteInstance* site_instance) {
187 return NULL; 188 return NULL;
188 } 189 }
189 190
190 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( 191 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget(
191 views::internal::NativeWidgetDelegate* delegate, 192 views::internal::NativeWidgetDelegate* delegate,
192 gfx::NativeView parent) { 193 gfx::NativeView parent) {
193 #if defined(USE_AURA) && !defined(OS_CHROMEOS) 194 #if defined(USE_AURA) && !defined(OS_CHROMEOS)
194 if (CommandLine::ForCurrentProcess()->HasSwitch( 195 if (CommandLine::ForCurrentProcess()->HasSwitch(
195 views::switches::kDesktopAura)) 196 views::switches::kDesktopAura))
196 return new views::DesktopNativeWidgetAura(delegate); 197 return new views::DesktopNativeWidgetAura(delegate);
197 #endif 198 #endif
198 return NULL; 199 return NULL;
199 } 200 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698