Eliminate OMNIBOX_OPENED_URL notification and its last usage
[chromium-blink-merge.git] / ui / views / views_delegate.cc
bloba676ae16610dc50286b5074f65c1c815ded22f6d
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 #if defined(OS_WIN)
58 HICON ViewsDelegate::GetDefaultWindowIcon() const {
59 return nullptr;
62 bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
63 return false;
65 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
66 gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
67 return nullptr;
69 #endif
71 NonClientFrameView* ViewsDelegate::CreateDefaultNonClientFrameView(
72 Widget* widget) {
73 return nullptr;
76 void ViewsDelegate::AddRef() {
79 void ViewsDelegate::ReleaseRef() {
82 content::WebContents* ViewsDelegate::CreateWebContents(
83 content::BrowserContext* browser_context,
84 content::SiteInstance* site_instance) {
85 return nullptr;
88 base::TimeDelta ViewsDelegate::GetDefaultTextfieldObscuredRevealDuration() {
89 return base::TimeDelta();
92 bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
93 return false;
96 ui::ContextFactory* ViewsDelegate::GetContextFactory() {
97 return nullptr;
100 std::string ViewsDelegate::GetApplicationName() {
101 base::FilePath program = base::CommandLine::ForCurrentProcess()->GetProgram();
102 return program.BaseName().AsUTF8Unsafe();
105 #if defined(OS_WIN)
106 int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor,
107 const base::Closure& callback) {
108 return EDGE_BOTTOM;
110 #endif
112 scoped_refptr<base::TaskRunner> ViewsDelegate::GetBlockingPoolTaskRunner() {
113 return nullptr;
116 ViewsDelegate::ViewsDelegate()
117 : views_tsc_factory_(new ViewsTouchEditingControllerFactory) {
118 DCHECK(!views_delegate);
119 views_delegate = this;
121 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_.get());
123 #if defined(USE_AURA)
124 touch_selection_menu_runner_.reset(new TouchSelectionMenuRunnerViews());
125 #endif
128 } // namespace views