Roll src/third_party/skia d32087a:1052f51
[chromium-blink-merge.git] / ui / views / views_delegate.cc
blob30d852527b93cd3f2d0abb714e527908641cc4ea
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/views/views_delegate.h"
7 #include "base/command_line.h"
8 #include "ui/views/views_touch_selection_controller_factory.h"
10 #if defined(USE_AURA)
11 #include "ui/views/touchui/touch_selection_menu_runner_views.h"
12 #endif
14 namespace views {
15 namespace {
17 ViewsDelegate* views_delegate = nullptr;
21 ViewsDelegate::~ViewsDelegate() {
22 ui::TouchEditingControllerFactory::SetInstance(nullptr);
24 DCHECK_EQ(this, views_delegate);
25 views_delegate = nullptr;
28 ViewsDelegate* ViewsDelegate::GetInstance() {
29 return views_delegate;
32 void ViewsDelegate::SaveWindowPlacement(const Widget* widget,
33 const std::string& window_name,
34 const gfx::Rect& bounds,
35 ui::WindowShowState show_state) {
38 bool ViewsDelegate::GetSavedWindowPlacement(
39 const Widget* widget,
40 const std::string& window_name,
41 gfx::Rect* bounds,
42 ui::WindowShowState* show_state) const {
43 return false;
46 void ViewsDelegate::NotifyAccessibilityEvent(View* view,
47 ui::AXEvent event_type) {
50 void ViewsDelegate::NotifyMenuItemFocused(const base::string16& menu_name,
51 const base::string16& menu_item_name,
52 int item_index,
53 int item_count,
54 bool has_submenu) {
57 ViewsDelegate::ProcessMenuAcceleratorResult
58 ViewsDelegate::ProcessAcceleratorWhileMenuShowing(
59 const ui::Accelerator& accelerator) {
60 return ProcessMenuAcceleratorResult::LEAVE_MENU_OPEN;
63 #if defined(OS_WIN)
64 HICON ViewsDelegate::GetDefaultWindowIcon() const {
65 return nullptr;
68 bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
69 return false;
71 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
72 gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
73 return nullptr;
75 #endif
77 NonClientFrameView* ViewsDelegate::CreateDefaultNonClientFrameView(
78 Widget* widget) {
79 return nullptr;
82 void ViewsDelegate::AddRef() {
85 void ViewsDelegate::ReleaseRef() {
88 content::WebContents* ViewsDelegate::CreateWebContents(
89 content::BrowserContext* browser_context,
90 content::SiteInstance* site_instance) {
91 return nullptr;
94 base::TimeDelta ViewsDelegate::GetDefaultTextfieldObscuredRevealDuration() {
95 return base::TimeDelta();
98 bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
99 return false;
102 ui::ContextFactory* ViewsDelegate::GetContextFactory() {
103 return nullptr;
106 std::string ViewsDelegate::GetApplicationName() {
107 base::FilePath program = base::CommandLine::ForCurrentProcess()->GetProgram();
108 return program.BaseName().AsUTF8Unsafe();
111 #if defined(OS_WIN)
112 int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor,
113 const base::Closure& callback) {
114 return EDGE_BOTTOM;
116 #endif
118 scoped_refptr<base::TaskRunner> ViewsDelegate::GetBlockingPoolTaskRunner() {
119 return nullptr;
122 ViewsDelegate::ViewsDelegate()
123 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
124 DCHECK(!views_delegate);
125 views_delegate = this;
127 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
129 #if defined(USE_AURA)
130 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews());
131 #endif
134 } // namespace views