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"
11 #include "ui/views/touchui/touch_selection_menu_runner_views.h"
16 ViewsDelegate::ViewsDelegate()
17 : views_tsc_factory_(new ViewsTouchEditingControllerFactory
) {
18 ui::TouchEditingControllerFactory::SetInstance(views_tsc_factory_
.get());
21 touch_selection_menu_runner_
.reset(new TouchSelectionMenuRunnerViews());
25 ViewsDelegate::~ViewsDelegate() {
26 ui::TouchEditingControllerFactory::SetInstance(NULL
);
29 void ViewsDelegate::SaveWindowPlacement(const Widget
* widget
,
30 const std::string
& window_name
,
31 const gfx::Rect
& bounds
,
32 ui::WindowShowState show_state
) {
35 bool ViewsDelegate::GetSavedWindowPlacement(
37 const std::string
& window_name
,
39 ui::WindowShowState
* show_state
) const {
43 void ViewsDelegate::NotifyAccessibilityEvent(View
* view
,
44 ui::AXEvent event_type
) {
47 void ViewsDelegate::NotifyMenuItemFocused(const base::string16
& menu_name
,
48 const base::string16
& menu_item_name
,
55 HICON
ViewsDelegate::GetDefaultWindowIcon() const {
59 bool ViewsDelegate::IsWindowInMetro(gfx::NativeWindow window
) const {
62 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
63 gfx::ImageSkia
* ViewsDelegate::GetDefaultWindowIcon() const {
68 NonClientFrameView
* ViewsDelegate::CreateDefaultNonClientFrameView(
73 void ViewsDelegate::AddRef() {
76 void ViewsDelegate::ReleaseRef() {
79 content::WebContents
* ViewsDelegate::CreateWebContents(
80 content::BrowserContext
* browser_context
,
81 content::SiteInstance
* site_instance
) {
85 base::TimeDelta
ViewsDelegate::GetDefaultTextfieldObscuredRevealDuration() {
86 return base::TimeDelta();
89 bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized
) {
93 ui::ContextFactory
* ViewsDelegate::GetContextFactory() {
97 std::string
ViewsDelegate::GetApplicationName() {
98 base::FilePath program
= base::CommandLine::ForCurrentProcess()->GetProgram();
99 return program
.BaseName().AsUTF8Unsafe();
103 int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor
,
104 const base::Closure
& callback
) {
109 scoped_refptr
<base::TaskRunner
> ViewsDelegate::GetBlockingPoolTaskRunner() {