Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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. | |
| 4 | |
| 5 #include "chrome/browser/external_protocol/external_protocol_handler.h" | |
|
tapted
2017/01/24 04:02:43
I would have expected a presubmit to warn against
karandeepb
2017/01/24 06:12:23
I was following the example in external_protocol_a
| |
| 6 | |
| 7 #import "chrome/browser/ui/cocoa/external_protocol_dialog.h" | |
| 8 #include "chrome/browser/ui/external_protocol_dialog_delegate.h" | |
| 9 #include "chrome/browser/ui/views/external_protocol_dialog.h" | |
| 10 #include "ui/base/material_design/material_design_controller.h" | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 // Note: This is duplicated from | |
| 15 // chrome/browser/ui/views/external_protocol_dialog.cc. | |
| 16 void RunExternalProtocolDialogViews(const GURL& url, | |
| 17 int render_process_host_id, | |
| 18 int routing_id, | |
| 19 ui::PageTransition page_transition, | |
| 20 bool has_user_gesture) { | |
| 21 std::unique_ptr<ExternalProtocolDialogDelegate> delegate( | |
| 22 new ExternalProtocolDialogDelegate(url, render_process_host_id, | |
| 23 routing_id)); | |
| 24 if (delegate->program_name().empty()) { | |
| 25 // ShellExecute won't do anything. Don't bother warning the user. | |
| 26 return; | |
| 27 } | |
| 28 | |
| 29 // Windowing system takes ownership. | |
| 30 new ExternalProtocolDialog(std::move(delegate), render_process_host_id, | |
| 31 routing_id); | |
| 32 } | |
| 33 | |
| 34 } // namespace | |
| 35 | |
| 36 // static | |
| 37 void ExternalProtocolHandler::RunExternalProtocolDialog( | |
| 38 const GURL& url, | |
| 39 int render_process_host_id, | |
| 40 int routing_id, | |
| 41 ui::PageTransition page_transition, | |
| 42 bool has_user_gesture) { | |
| 43 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | |
| 44 RunExternalProtocolDialogViews(url, render_process_host_id, routing_id, | |
| 45 page_transition, has_user_gesture); | |
| 46 return; | |
| 47 } | |
| 48 [[ExternalProtocolDialogController alloc] initWithGURL:&url | |
| 49 renderProcessHostId:render_process_host_id | |
| 50 routingId:routing_id]; | |
| 51 } | |
| OLD | NEW |