Include all dupe types (event when value is zero) in scan stats.
[chromium-blink-merge.git] / mandoline / ui / browser / browser.h
blob3728f3ac9c33d4bd516cf6c53ef6436921042420
1 // Copyright 2015 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 #ifndef MANDOLINE_UI_BROWSER_BROWSER_H_
6 #define MANDOLINE_UI_BROWSER_BROWSER_H_
8 #include "components/view_manager/public/cpp/view_manager.h"
9 #include "components/view_manager/public/cpp/view_manager_delegate.h"
10 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h"
11 #include "mandoline/services/navigation/public/interfaces/navigation.mojom.h"
12 #include "mandoline/ui/browser/navigator_host_impl.h"
13 #include "mandoline/ui/browser/omnibox.mojom.h"
14 #include "mandoline/ui/browser/view_embedder.mojom.h"
15 #include "mojo/application/public/cpp/application_delegate.h"
16 #include "mojo/application/public/cpp/application_impl.h"
17 #include "mojo/application/public/cpp/connect.h"
18 #include "mojo/application/public/cpp/service_provider_impl.h"
19 #include "mojo/common/weak_binding_set.h"
20 #include "ui/mojo/events/input_events.mojom.h"
21 #include "url/gurl.h"
23 namespace mojo {
24 class ViewManagerInit;
27 namespace mandoline {
29 class BrowserUI;
30 class FrameTree;
31 class MergedServiceProvider;
33 class Browser : public mojo::ApplicationDelegate,
34 public mojo::ViewManagerDelegate,
35 public mojo::ViewManagerRootClient,
36 public OmniboxClient,
37 public ViewEmbedder,
38 public mojo::InterfaceFactory<mojo::NavigatorHost>,
39 public mojo::InterfaceFactory<ViewEmbedder> {
40 public:
41 Browser();
42 ~Browser() override;
44 void ReplaceContentWithRequest(mojo::URLRequestPtr request);
46 mojo::View* content() { return content_; }
47 mojo::View* omnibox() { return omnibox_; }
49 const GURL& current_url() const { return current_url_; }
51 private:
52 // Overridden from mojo::ApplicationDelegate:
53 void Initialize(mojo::ApplicationImpl* app) override;
54 bool ConfigureIncomingConnection(
55 mojo::ApplicationConnection* connection) override;
56 bool ConfigureOutgoingConnection(
57 mojo::ApplicationConnection* connection) override;
59 // Overridden from mojo::ViewManagerDelegate:
60 void OnEmbed(mojo::View* root,
61 mojo::InterfaceRequest<mojo::ServiceProvider> services,
62 mojo::ServiceProviderPtr exposed_services) override;
63 bool OnWillEmbed(mojo::View* view,
64 mojo::InterfaceRequest<mojo::ServiceProvider>* services,
65 mojo::ServiceProviderPtr* exposed_services) override;
66 void OnViewManagerDestroyed(mojo::ViewManager* view_manager) override;
68 // Overridden from ViewManagerRootClient:
69 void OnAccelerator(mojo::EventPtr event) override;
71 // Overridden from OmniboxClient:
72 void OpenURL(const mojo::String& url) override;
74 // Overridden from ViewEmbedder:
75 void Embed(mojo::URLRequestPtr request,
76 mojo::InterfaceRequest<mojo::ServiceProvider> services,
77 mojo::ServiceProviderPtr exposed_services) override;
79 // Overridden from mojo::InterfaceFactory<mojo::NavigatorHost>:
80 void Create(mojo::ApplicationConnection* connection,
81 mojo::InterfaceRequest<mojo::NavigatorHost> request) override;
83 // Overridden from mojo::InterfaceFactory<ViewEmbedder>:
84 void Create(mojo::ApplicationConnection* connection,
85 mojo::InterfaceRequest<ViewEmbedder> request) override;
87 void ShowOmnibox(mojo::URLRequestPtr request,
88 mojo::InterfaceRequest<mojo::ServiceProvider> services,
89 mojo::ServiceProviderPtr exposed_services);
91 scoped_ptr<mojo::ViewManagerInit> view_manager_init_;
93 // Only support being embedded once, so both application-level
94 // and embedding-level state are shared on the same object.
95 mojo::View* root_;
96 mojo::View* content_;
97 mojo::View* omnibox_;
98 std::string default_url_;
99 mojo::URLRequestPtr pending_request_;
101 mojo::ServiceProviderImpl exposed_services_impl_;
102 scoped_ptr<MergedServiceProvider> merged_service_provider_;
104 mojo::WeakBindingSet<ViewEmbedder> view_embedder_bindings_;
106 NavigatorHostImpl navigator_host_;
108 GURL current_url_;
110 scoped_ptr<BrowserUI> ui_;
111 mojo::ApplicationImpl* app_;
113 scoped_ptr<FrameTree> frame_tree_;
115 DISALLOW_COPY_AND_ASSIGN(Browser);
118 } // namespace mandoline
120 #endif // MANDOLINE_UI_BROWSER_BROWSER_H_