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

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

Issue 9166014: Allow a Views client to provide a default frameview for window widgets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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) 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/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/screen.h" 19 #include "ui/gfx/screen.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
27 #if defined(USE_AURA)
28 #include "ash/shell.h"
29 #endif
30
27 namespace { 31 namespace {
28 32
29 // If the given window has a profile associated with it, use that profile's 33 // If the given window has a profile associated with it, use that profile's
30 // preference service. Otherwise, store and retrieve the data from Local State. 34 // preference service. Otherwise, store and retrieve the data from Local State.
31 // This function may return NULL if the necessary pref service has not yet 35 // This function may return NULL if the necessary pref service has not yet
32 // been initialized. 36 // been initialized.
33 // TODO(mirandac): This function will also separate windows by profile in a 37 // TODO(mirandac): This function will also separate windows by profile in a
34 // multi-profile environment. 38 // multi-profile environment.
35 PrefService* GetPrefsForWindow(const views::Widget* window) { 39 PrefService* GetPrefsForWindow(const views::Widget* window) {
36 Profile* profile = reinterpret_cast<Profile*>( 40 Profile* profile = reinterpret_cast<Profile*>(
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 AccessibilityEventRouterViews::GetInstance()->HandleMenuItemFocused( 121 AccessibilityEventRouterViews::GetInstance()->HandleMenuItemFocused(
118 menu_name, menu_item_name, item_index, item_count, has_submenu); 122 menu_name, menu_item_name, item_index, item_count, has_submenu);
119 } 123 }
120 124
121 #if defined(OS_WIN) 125 #if defined(OS_WIN)
122 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const { 126 HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
123 return GetAppIcon(); 127 return GetAppIcon();
124 } 128 }
125 #endif 129 #endif
126 130
131 views::NonClientFrameView* ChromeViewsDelegate::CreateDefaultNonClientFrameView(
132 views::Widget* widget) {
133 #if defined(USE_AURA)
134 return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget);
135 #endif
136 }
sky 2012/01/10 21:45:30 #else return NULL
137
127 void ChromeViewsDelegate::AddRef() { 138 void ChromeViewsDelegate::AddRef() {
128 g_browser_process->AddRefModule(); 139 g_browser_process->AddRefModule();
129 } 140 }
130 141
131 void ChromeViewsDelegate::ReleaseRef() { 142 void ChromeViewsDelegate::ReleaseRef() {
132 g_browser_process->ReleaseModule(); 143 g_browser_process->ReleaseModule();
133 } 144 }
134 145
135 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) { 146 int ChromeViewsDelegate::GetDispositionForEvent(int event_flags) {
136 return event_utils::DispositionFromEventFlags(event_flags); 147 return event_utils::DispositionFromEventFlags(event_flags);
137 } 148 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698