Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Unified Diff: components/arc/intent_helper/link_handler_model_impl.h

Issue 1760773004: Add "Open with <ARC-app-name>" items to the context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address dcheng's comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/arc/intent_helper/link_handler_model_impl.h
diff --git a/components/arc/intent_helper/link_handler_model_impl.h b/components/arc/intent_helper/link_handler_model_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..9a5ff96fd49167279f2d465a0107ab197f490a7a
--- /dev/null
+++ b/components/arc/intent_helper/link_handler_model_impl.h
@@ -0,0 +1,46 @@
+// Copyright 2016 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 COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_
+#define COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_
+
+#include "ash/link_handler_model.h"
+#include "base/memory/weak_ptr.h"
+#include "components/arc/arc_service.h"
+#include "components/arc/common/intent_helper.mojom.h"
+
+namespace arc {
+
+class LinkHandlerModelImpl : public ash::LinkHandlerModel {
+ public:
+ LinkHandlerModelImpl();
+ ~LinkHandlerModelImpl() override;
+
+ // ash::LinkHandlerModel overrides:
+ void AddObserver(Observer* observer) override;
+ void OpenLinkWithHandler(const GURL& url, uint32_t handler_id) override;
+
+ // Starts retrieving handler information for the |url| and returns true.
+ // Returns false when the information cannot be retrieved. In that case,
+ // the caller should delete |this| object.
+ bool Init(const GURL& url);
+
+ private:
+ mojom::IntentHelperInstance* GetIntentHelper();
+ void OnUrlHandlerList(mojo::Array<mojom::UrlHandlerInfoPtr> handlers);
+ void NotifyObserver();
+
+ Observer* observer_;
+ mojo::Array<mojom::UrlHandlerInfoPtr> handlers_;
+
+ // Always keep this the last member of this class to make sure it's the
+ // first thing to be destructed.
+ base::WeakPtrFactory<LinkHandlerModelImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkHandlerModelImpl);
+};
+
+} // namespace arc
+
+#endif // COMPONENTS_ARC_INTENT_HELPER_LINK_HANDLER_MODEL_IMPL_H_
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.cc ('k') | components/arc/intent_helper/link_handler_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698