Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add skeleton for chrome://parallels-internal
Bug: b/173653141 Test: visit chrome://parallels-internal manually Change-Id: I86ae119c9e102808183995c1eb60b9395ee3b885 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2719248 Commit-Queue: Jason Lin <lxj@google.com> Reviewed-by: calamity <calamity@chromium.org> Cr-Commit-Position: refs/heads/master@{#858479}
- Loading branch information
Jason Lin
authored and
Chromium LUCI CQ
committed
Mar 1, 2021
1 parent
17904b1
commit 36bfd11
Showing
7 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
file://chrome/browser/chromeos/guest_os/OWNERS |
51 changes: 51 additions & 0 deletions
51
chrome/browser/ui/webui/chromeos/plugin_vm_internal/plugin_vm_internal_ui.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Copyright 2021 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. | ||
|
||
#include "chrome/browser/ui/webui/chromeos/plugin_vm_internal/plugin_vm_internal_ui.h" | ||
|
||
#include "base/memory/ref_counted_memory.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "chrome/common/webui_url_constants.h" | ||
#include "content/public/browser/url_data_source.h" | ||
|
||
// TODO(b/173653141) We need to port this to lacros eventually. | ||
|
||
namespace chromeos { | ||
|
||
namespace { | ||
|
||
class DataSource : public content::URLDataSource { | ||
std::string GetSource() override { | ||
return chrome::kChromeUIPluginVmInternalHost; | ||
} | ||
|
||
void StartDataRequest(const GURL& url, | ||
const content::WebContents::Getter& wc_getter, | ||
GotDataCallback callback) override { | ||
// TODO(b/173653141) Send actual diagnosis. | ||
std::string rv = "parallels diagnosis"; | ||
std::move(callback).Run(base::RefCountedString::TakeString(&rv)); | ||
} | ||
|
||
std::string GetMimeType(const std::string& path) override { | ||
return "text/plain"; | ||
} | ||
|
||
bool AllowCaching() override { | ||
// We need to generate new diagnosis every time. | ||
return false; | ||
} | ||
}; | ||
|
||
} // namespace | ||
|
||
PluginVmInternalUI::PluginVmInternalUI(content::WebUI* web_ui) | ||
: content::WebUIController(web_ui) { | ||
auto* profile = Profile::FromWebUI(web_ui); | ||
content::URLDataSource::Add(profile, std::make_unique<DataSource>()); | ||
} | ||
|
||
PluginVmInternalUI::~PluginVmInternalUI() = default; | ||
|
||
} // namespace chromeos |
23 changes: 23 additions & 0 deletions
23
chrome/browser/ui/webui/chromeos/plugin_vm_internal/plugin_vm_internal_ui.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2021 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 CHROME_BROWSER_UI_WEBUI_CHROMEOS_PLUGIN_VM_INTERNAL_PLUGIN_VM_INTERNAL_UI_H_ | ||
#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_PLUGIN_VM_INTERNAL_PLUGIN_VM_INTERNAL_UI_H_ | ||
|
||
#include "content/public/browser/web_ui_controller.h" | ||
|
||
namespace chromeos { | ||
|
||
// The WebUI for chrome://parallels-internal | ||
class PluginVmInternalUI : public content::WebUIController { | ||
public: | ||
explicit PluginVmInternalUI(content::WebUI* web_ui); | ||
PluginVmInternalUI(const PluginVmInternalUI&) = delete; | ||
PluginVmInternalUI& operator=(const PluginVmInternalUI&) = delete; | ||
~PluginVmInternalUI() override; | ||
}; | ||
|
||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_PLUGIN_VM_INTERNAL_PLUGIN_VM_INTERNAL_UI_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters