Chromium Code Reviews| 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/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 Loading... | |
| 72 | 72 |
| 73 DCHECK(prefs->FindPreference(window_name.c_str())); | 73 DCHECK(prefs->FindPreference(window_name.c_str())); |
| 74 DictionaryPrefUpdate update(prefs, window_name.c_str()); | 74 DictionaryPrefUpdate update(prefs, window_name.c_str()); |
| 75 DictionaryValue* window_preferences = update.Get(); | 75 DictionaryValue* window_preferences = update.Get(); |
| 76 window_preferences->SetInteger("left", bounds.x()); | 76 window_preferences->SetInteger("left", bounds.x()); |
| 77 window_preferences->SetInteger("top", bounds.y()); | 77 window_preferences->SetInteger("top", bounds.y()); |
| 78 window_preferences->SetInteger("right", bounds.right()); | 78 window_preferences->SetInteger("right", bounds.right()); |
| 79 window_preferences->SetInteger("bottom", bounds.bottom()); | 79 window_preferences->SetInteger("bottom", bounds.bottom()); |
| 80 window_preferences->SetBoolean("maximized", | 80 window_preferences->SetBoolean("maximized", |
| 81 show_state == ui::SHOW_STATE_MAXIMIZED); | 81 show_state == ui::SHOW_STATE_MAXIMIZED); |
| 82 gfx::Rect work_area( | 82 gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())-> |
| 83 gfx::Screen::GetDisplayMatching(bounds).work_area()); | 83 GetDisplayMatching(bounds).work_area()); |
| 84 window_preferences->SetInteger("work_area_left", work_area.x()); | 84 window_preferences->SetInteger("work_area_left", work_area.x()); |
| 85 window_preferences->SetInteger("work_area_top", work_area.y()); | 85 window_preferences->SetInteger("work_area_top", work_area.y()); |
| 86 window_preferences->SetInteger("work_area_right", work_area.right()); | 86 window_preferences->SetInteger("work_area_right", work_area.right()); |
| 87 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); | 87 window_preferences->SetInteger("work_area_bottom", work_area.bottom()); |
| 88 } | 88 } |
| 89 | 89 |
| 90 bool ChromeViewsDelegate::GetSavedWindowPlacement( | 90 bool ChromeViewsDelegate::GetSavedWindowPlacement( |
| 91 const std::string& window_name, | 91 const std::string& window_name, |
| 92 gfx::Rect* bounds, | 92 gfx::Rect* bounds, |
| 93 ui::WindowShowState* show_state) const { | 93 ui::WindowShowState* show_state) const { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 void ChromeViewsDelegate::ReleaseRef() { | 161 void ChromeViewsDelegate::ReleaseRef() { |
| 162 g_browser_process->ReleaseModule(); | 162 g_browser_process->ReleaseModule(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { | 165 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { |
| 166 return chrome::DispositionFromEventFlags(event_flags); | 166 return chrome::DispositionFromEventFlags(event_flags); |
| 167 } | 167 } |
| 168 | 168 |
| 169 #if defined(USE_AURA) | 169 #if defined(USE_AURA) |
| 170 views::NativeWidgetHelperAura* ChromeViewsDelegate::CreateNativeWidgetHelper( | 170 views::NativeWidgetHelperAura* ChromeViewsDelegate::CreateNativeWidgetHelper( |
| 171 views::NativeWidgetAura* native_widget) { | 171 views::NativeWidgetAura* native_widget, gfx::NativeView parent) { |
|
Ben Goodger (Google)
2012/10/10 22:52:10
given that you don't use this value here, I don't
scottmg
2012/10/11 00:22:28
Oops, thanks. I think that was from when this meth
| |
| 172 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) | 172 #if !defined(OS_CHROMEOS) && !defined(OS_WIN) |
| 173 // TODO(erg): get rid of this, it's interfering with desktop-aura. | 173 // TODO(erg): get rid of this, it's interfering with desktop-aura. |
| 174 return new views::DesktopNativeWidgetHelperAura(native_widget); | 174 return new views::DesktopNativeWidgetHelperAura(native_widget); |
| 175 #else | 175 #else |
| 176 return NULL; | 176 return NULL; |
| 177 #endif | 177 #endif |
| 178 } | 178 } |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 content::WebContents* ChromeViewsDelegate::CreateWebContents( | 181 content::WebContents* ChromeViewsDelegate::CreateWebContents( |
| 182 content::BrowserContext* browser_context, | 182 content::BrowserContext* browser_context, |
| 183 content::SiteInstance* site_instance) { | 183 content::SiteInstance* site_instance) { |
| 184 return NULL; | 184 return NULL; |
| 185 } | 185 } |
| 186 | 186 |
| 187 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( | 187 views::NativeWidget* ChromeViewsDelegate::CreateNativeWidget( |
| 188 views::Widget::InitParams::Type type, | 188 views::Widget::InitParams::Type type, |
| 189 views::internal::NativeWidgetDelegate* delegate, | 189 views::internal::NativeWidgetDelegate* delegate, |
| 190 gfx::NativeView parent) { | 190 gfx::NativeView parent) { |
| 191 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 191 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
| 192 if (parent && type != views::Widget::InitParams::TYPE_MENU) | 192 if (parent && type != views::Widget::InitParams::TYPE_MENU) |
| 193 return new views::NativeWidgetAura(delegate); | 193 return new views::NativeWidgetAura(delegate, NULL); |
| 194 if (CommandLine::ForCurrentProcess()->HasSwitch( | 194 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 195 views::switches::kDesktopAura)) | 195 views::switches::kDesktopAura)) |
| 196 return new views::DesktopNativeWidgetAura(delegate); | 196 return new views::DesktopNativeWidgetAura(delegate); |
| 197 #endif | 197 #endif |
| 198 return NULL; | 198 return NULL; |
| 199 } | 199 } |
| OLD | NEW |