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

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 comments 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..d82ad9395fb8ec5c150f786ef8b627b9e2962eba
--- /dev/null
+++ b/components/arc/intent_helper/link_handler_model_impl.h
@@ -0,0 +1,51 @@
+// 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/renderer_context_menu/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 ArcBridgeService;
+
+class LinkHandlerModelImpl : public ash::LinkHandlerModel {
+ public:
+ explicit LinkHandlerModelImpl(ArcBridgeService* bridge_service);
+ ~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:
+ IntentHelperInstance* GetIntentHelper();
+ void OnUrlHandlerList(mojo::Array<UrlHandlerInfoPtr> handlers);
+ void NotifyObserver();
+
+ ArcBridgeService* bridge_service_;
+
+ Observer* observer_;
+ mojo::Array<UrlHandlerInfoPtr> handlers_;
+ bool has_results_;
+
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698