| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 window->GetNativeWindowProperty(Profile::kProfileKey)); | 37 window->GetNativeWindowProperty(Profile::kProfileKey)); |
| 38 if (!profile) { | 38 if (!profile) { |
| 39 // Use local state for windows that have no explicit profile. | 39 // Use local state for windows that have no explicit profile. |
| 40 return g_browser_process->local_state(); | 40 return g_browser_process->local_state(); |
| 41 } | 41 } |
| 42 return profile->GetPrefs(); | 42 return profile->GetPrefs(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 // static | |
| 48 views::View* ChromeViewsDelegate::default_parent_view = NULL; | |
| 49 | |
| 50 /////////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////////// |
| 51 // ChromeViewsDelegate, views::ViewsDelegate implementation: | 48 // ChromeViewsDelegate, views::ViewsDelegate implementation: |
| 52 | 49 |
| 53 ui::Clipboard* ChromeViewsDelegate::GetClipboard() const { | 50 ui::Clipboard* ChromeViewsDelegate::GetClipboard() const { |
| 54 return g_browser_process->clipboard(); | 51 return g_browser_process->clipboard(); |
| 55 } | 52 } |
| 56 | 53 |
| 57 views::View* ChromeViewsDelegate::GetDefaultParentView() { | |
| 58 return default_parent_view; | |
| 59 } | |
| 60 | |
| 61 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, | 54 void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, |
| 62 const std::string& window_name, | 55 const std::string& window_name, |
| 63 const gfx::Rect& bounds, | 56 const gfx::Rect& bounds, |
| 64 ui::WindowShowState show_state) { | 57 ui::WindowShowState show_state) { |
| 65 PrefService* prefs = GetPrefsForWindow(window); | 58 PrefService* prefs = GetPrefsForWindow(window); |
| 66 if (!prefs) | 59 if (!prefs) |
| 67 return; | 60 return; |
| 68 | 61 |
| 69 DCHECK(prefs->FindPreference(window_name.c_str())); | 62 DCHECK(prefs->FindPreference(window_name.c_str())); |
| 70 DictionaryPrefUpdate update(prefs, window_name.c_str()); | 63 DictionaryPrefUpdate update(prefs, window_name.c_str()); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 g_browser_process->AddRefModule(); | 131 g_browser_process->AddRefModule(); |
| 139 } | 132 } |
| 140 | 133 |
| 141 void ChromeViewsDelegate::ReleaseRef() { | 134 void ChromeViewsDelegate::ReleaseRef() { |
| 142 g_browser_process->ReleaseModule(); | 135 g_browser_process->ReleaseModule(); |
| 143 } | 136 } |
| 144 | 137 |
| 145 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { | 138 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { |
| 146 return event_utils::DispositionFromEventFlags(event_flags); | 139 return event_utils::DispositionFromEventFlags(event_flags); |
| 147 } | 140 } |
| OLD | NEW |