forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reland "[DevUI DFM] Change install flow to use NavigationThrottle."
This reverts commit 168860e. Reason for reland: Fixed problem: The target source_set("dev_ui_loader") had missing dependencies, and doesn't reach. third_party/blink/public/mojom:mojom_platform Two ways to fix this are: A: Add the missing dependencies to chrome/browser/dev_ui/android:dev_ui_loader B: Remove chrome/browser/dev_ui/android:dev_ui_loader, and fold its {sources, deps} into chrome/browser:browser. We're choosing B for simplicity, but may adopt A eventually. Original change's description: > Revert "[DevUI DFM] Change install flow to use NavigationThrottle." > > Reason for revert: Seems to have broken android-archive-rel compile, though this may be exposing some pre-existing bad dependency elsewhere: https://ci.chromium.org/p/chromium/builders/ci/android-archive-rel/5717 > > Change-Id: I7eff36d7e01c31a76f39250a255d27972b0962d9 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864392 > Commit-Queue: Peter Kasting <pkasting@chromium.org> > Original change's description: > > [DevUI DFM] Change install flow to use NavigationThrottle. > > > > Bug: 927131,987040,1013522 > > Change-Id: I5c384671c858d26a303afc58c03f4314c8ef0117 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854524 > > Commit-Queue: Samuel Huang <huangs@chromium.org> TBR=pkasting@chromium.org,creis@chromium.org,huangs@chromium.org,thestig@chromium.org,dbeam@chromium.org,agrieve@chromium.org,tiborg@chromium.org Bug: 927131, 987040, 1013522 Change-Id: I526f3194b0115171721a53fca60fa6ffa6e3c441 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1864411 Reviewed-by: Samuel Huang <huangs@chromium.org> Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Samuel Huang <huangs@chromium.org> Cr-Commit-Position: refs/heads/master@{#706514}
- Loading branch information
1 parent
36e460f
commit 3a1ce1c
Showing
26 changed files
with
538 additions
and
380 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
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
huangs@chromium.org | ||
tiborg@chromium.org |
File renamed without changes.
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,33 @@ | ||
// Copyright 2019 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/dev_ui/android/dev_ui_loader_error_page.h" | ||
|
||
#include "chrome/grit/browser_resources.h" | ||
#include "components/strings/grit/components_strings.h" | ||
#include "ui/base/l10n/l10n_util.h" | ||
#include "ui/base/resource/resource_bundle.h" | ||
#include "ui/base/template_expressions.h" | ||
#include "ui/strings/grit/ui_strings.h" | ||
|
||
namespace dev_ui { | ||
|
||
std::string BuildErrorPageHtml() { | ||
ui::TemplateReplacements replacements; | ||
replacements["h1"] = | ||
l10n_util::GetStringUTF8(IDS_DEV_UI_LOADER_ERROR_HEADING); | ||
replacements["p"] = | ||
l10n_util::GetStringUTF8(IDS_ERRORPAGES_SUGGESTION_LIST_HEADER); | ||
replacements["li-1"] = | ||
l10n_util::GetStringUTF8(IDS_DEV_UI_LOADER_ERROR_SUGGEST_RELOAD); | ||
replacements["li-2"] = | ||
l10n_util::GetStringUTF8(IDS_DEV_UI_LOADER_ERROR_SUGGEST_CHECK_INTERNET); | ||
|
||
std::string source = | ||
ui::ResourceBundle::GetSharedInstance().DecompressDataResource( | ||
IDR_DEV_UI_LOADER_ERROR_HTML); | ||
return ui::ReplaceTemplateExpressions(source, replacements); | ||
} | ||
|
||
} // namespace dev_ui |
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,16 @@ | ||
// Copyright 2019 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_DEV_UI_ANDROID_DEV_UI_LOADER_ERROR_PAGE_H_ | ||
#define CHROME_BROWSER_DEV_UI_ANDROID_DEV_UI_LOADER_ERROR_PAGE_H_ | ||
|
||
#include <string> | ||
|
||
namespace dev_ui { | ||
|
||
std::string BuildErrorPageHtml(); | ||
|
||
} // namespace dev_ui | ||
|
||
#endif // CHROME_BROWSER_DEV_UI_ANDROID_DEV_UI_LOADER_ERROR_PAGE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2019 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_DEV_UI_ANDROID_DEV_UI_LOADER_THROTTLE_H_ | ||
#define CHROME_BROWSER_DEV_UI_ANDROID_DEV_UI_LOADER_THROTTLE_H_ | ||
|
||
#include <memory> | ||
|
||
#include "base/memory/weak_ptr.h" | ||
#include "content/public/browser/navigation_throttle.h" | ||
|
||
namespace content { | ||
class NavigationHandle; | ||
} // namespace content | ||
|
||
class GURL; | ||
|
||
namespace dev_ui { | ||
|
||
// For DevUI page navigations, if the DevUI DFM is not installed then delay | ||
// navigation and perform installation. On success, resumes navigation. On | ||
// failure, displays error (retries install on refresh). | ||
class DevUiLoaderThrottle : public content::NavigationThrottle { | ||
public: | ||
// Determines whether visiting |url| should trigger DevUI DFM install. | ||
static bool ShouldInstallDevUiDfm(const GURL& url); | ||
|
||
// Creates a throttle if the DevUI DFM needs to be installed. If the DevUI DFM | ||
// will be used, is installed, but is not loaded, then resource load takes | ||
// place as a side effect. | ||
static std::unique_ptr<content::NavigationThrottle> MaybeCreateThrottleFor( | ||
content::NavigationHandle* handle); | ||
|
||
explicit DevUiLoaderThrottle(content::NavigationHandle* navigation_handle); | ||
~DevUiLoaderThrottle() override; | ||
DevUiLoaderThrottle(const DevUiLoaderThrottle&) = delete; | ||
const DevUiLoaderThrottle& operator=(const DevUiLoaderThrottle&) = delete; | ||
|
||
// content::NavigationThrottle: | ||
const char* GetNameForLogging() override; | ||
ThrottleCheckResult WillStartRequest() override; | ||
|
||
private: | ||
// Callback for dev_ui::DevUiModuleProvider::InstallModule(). | ||
void OnDevUiDfmInstallWithStatus(bool success); | ||
|
||
// Factory for creating references in callbacks. | ||
base::WeakPtrFactory<DevUiLoaderThrottle> weak_ptr_factory_{this}; | ||
}; | ||
|
||
} // namespace dev_ui | ||
|
||
#endif // CHROME_BROWSER_DEV_UI_ANDROID_DEV_UI_LOADER_THROTTLE_H_ |
Oops, something went wrong.