blob: ff56a40622ba93e28dc951fff18ae779cd383c3e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_
#define MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_
#include "components/view_manager/public/cpp/view_manager_delegate.h"
#include "mandoline/ui/desktop_ui/public/interfaces/omnibox.mojom.h"
#include "mandoline/ui/desktop_ui/public/interfaces/view_embedder.mojom.h"
#include "mojo/application/public/cpp/application_delegate.h"
#include "mojo/application/public/cpp/interface_factory.h"
#include "mojo/common/weak_binding_set.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/layout/layout_manager.h"
namespace mojo {
class ViewTreeClientFactory;
}
namespace mandoline {
class AuraInit;
class OmniboxImpl : public mojo::ApplicationDelegate,
public mojo::ViewManagerDelegate,
public views::LayoutManager,
public views::TextfieldController,
public mojo::InterfaceFactory<Omnibox>,
public mojo::InterfaceFactory<mojo::ViewTreeClient>,
public Omnibox {
public:
OmniboxImpl();
~OmniboxImpl() override;
private:
// Overridden from mojo::ApplicationDelegate:
void Initialize(mojo::ApplicationImpl* app) override;
bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) override;
bool ConfigureOutgoingConnection(
mojo::ApplicationConnection* connection) override;
// Overridden from mojo::ViewManagerDelegate:
void OnEmbed(mojo::View* root) override;
void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override;
// Overridden from views::LayoutManager:
gfx::Size GetPreferredSize(const views::View* view) const override;
void Layout(views::View* host) override;
// Overridden from views::TextfieldController:
bool HandleKeyEvent(views::Textfield* sender,
const ui::KeyEvent& key_event) override;
// Overridden from mojo::InterfaceFactory<Omnibox>:
void Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<Omnibox> request) override;
// Overridden from mojo::InterfaceFactory<mojo::ViewTreeClient>:
void Create(
mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<mojo::ViewTreeClient> request) override;
// Overridden from Omnibox:
void ShowForURL(const mojo::String& url) override;
void HideWindow();
void ShowWindow();
scoped_ptr<AuraInit> aura_init_;
mojo::ApplicationImpl* app_impl_;
mojo::View* root_;
mojo::String url_;
views::Textfield* edit_;
mojo::WeakBindingSet<Omnibox> bindings_;
ViewEmbedderPtr view_embedder_;
DISALLOW_COPY_AND_ASSIGN(OmniboxImpl);
};
} // namespace mandoline
#endif // MANDOLINE_UI_OMNIBOX_OMNIBOX_IMPL_H_
|