0
Commit Graph

19 Commits

Author SHA1 Message Date
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Lei Zhang
7ab31375dd Do IWYU for content_export.h
Headers that use CONTENT_EXPORT should include content_export.h.

Change-Id: I66b65c9c3a963d1f4677172b12ef0966448e1609
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3282640
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#942394}
2021-11-17 01:26:00 +00:00
Peter Boström
1d6a095400 Remove unused "base/macros.h" in content/
Removes `#include "base/macros.h"` from files in content/ that do not
contain `ignore_result(`.

Bug: 1010217
No-Try: true
Change-Id: I887403408704241047e3bd66e953ff7df195368b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274993
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940781}
2021-11-11 16:07:03 +00:00
Peter Boström
9b036533b6 Remove DISALLOW_* macros from content/
This inlines all remaining DISALLOW_* macros in content/. This is done
manually (vim regex + manually finding insertion position).

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: I8b5ea6dd9f8a3f584cf3eef82634017a38b15be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3193883
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#936160}
2021-10-28 23:37:28 +00:00
Lukasz Anforowicz
7b07879d6e Remove url_formatter::FixupURL call from WillHandleBrowserAboutURL.
Motivation for this CL
======================

Before this CL url_formatter::FixupURL could transform URLs of
renderer-initiated navigations.  This may have allowed an attacker to
"launder" URLs past early filters (if the initial URL provided by the
attacker looks benign, but after passing the filters is transformed by
FixupURL into a malicious form).  The following bugs in the past seem to
have been at least partially enabled by this transformation:
- Laundering a "javascript:" URL:
  https://crbug.com/1116280 and https://crbug.com/850824
- Omnibox spoof due to the modified url:
  https://crbug.com/449829 and https://crbug.com/657720
- Invariant violation due to a difference between virtual url and
  regular url: https://crbug.com/895065

Before this CL, url_formatter::FixupURL was called for
renderer-initiated navigations via WillHandleBrowserAboutURL.  This
doesn’t seem necessary per the TODO in this function asking to
"Eliminate "about:*" constants [...] then hopefully we can remove this
forced fixup".

Note that BrowserURLHandler::SetFixupHandler has been introduced in
r316923 as a workaround to ensure URL consistency by adding FixupURL in
one more place.  If FixupURL wouldn’t be called from
WillHandleBrowserAboutURL, then BrowserURLHandler::SetFixupHandler
wouldn’t be needed in the first place.

Finally, https://crbug.com/1130091#c3 points out that
url_formatter::FixupURL should only be invoked on user input (e.g.  URLs
typed into the omnibox and used for browser-initiated navigations)
rather than on arbitrary URLs.


Summary of changes in this CL
=============================

Based on the above, the CL:
- Removes the FixupBrowserAboutURL call from WillHandleBrowserAboutURL
- Removes the BrowserURLHandler::SetFixupHandler method and related code
- Fixes tests so that they use the final URL form (rather than relying
  on the FixupURL call)
- Adjusting expectations of tests that were testing laundering scenarios

The CL also opportunistically:
- Simplifies WillHandleBrowserAboutURL (path transformations were a
  no-op;  early return for kChromeUISettingsHost and kChromeUIHelpHost
  can be consolidated)


Testing
=======

Manual testing:
- Verified that "about:version" typed into the omnibox still ends up
  navigating to "chrome://version/"
- Verified that renderer-initiated navigations to "about:version" are
  translated into "about:blank#blocked" by
  RenderProcessHostImpl::FilterURL

Bug: 1130091
Change-Id: I9a9f32d4d9c0ec630c2110679efe0c1d18b4370b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2441284
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818969}
2020-10-20 17:04:31 +00:00
Devlin Cronin
9d570a2219 [Extensions UI] Customize the NTP overridden prompt for the default case
If the NTP was overridden from its default state with Google as the
search provider, show a branded dialog and custom message to the user.

This requires a bit of code acrobatics in order to determine what the
previous NTP and search engine will be. In particular, we need to:
1) Determine if the default search is Google
2) Determine if the default NTP is the "secondary" NTP

1) is relatively straightforward; 2) is more complicated. The NTP can
be overridden by several different sources (extensions, policies, or
a different default search provider). In order to accommodate this,
introduce BrowserURLHandler::GetPossibleRewrites(), which iterates over
all rewriters and accumulates the list of rewrites that would happen.
This, in conjunction with also checking for multiple NTP overriding
extensions, allows us to check if the default NTP would be used if the
overriding extension were removed.

Add tests for various pieces:
- BrowserURLHandler::GetPossibleRewrites()
- ExtensionWebUI::GetNumberOfExtensionsOverridingURL()
- The dialog params generated when a non-default search is selected
- The dialog params generated when multiple NTP-overriding extensions
  are installed
- UI browser tests for both the generic and the default-specific
  dialogs.

Bug: 1079364
Change-Id: I6d37eb8fa85cd824155a9907253a57f1d8cfd51c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2202156
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Brian White <bcwhite@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#774653}
2020-06-03 16:00:59 +00:00
Lukasz Anforowicz
b2eb19b1ce Remove |reverse_on_redirect| from //content-public RewriteURL... method.
This CL removes the |reverse_on_redirect| out parameter from the
//content-public version of the BrowserURLHandler::RewriteURLIfNecessary
method.  This is justified by the fact that outside of //content all
callers of that method would ignore this out parameter.

The CL keeps the |reverse_on_redirect| in the //content-internal
overload of the method in BrowserURLHandlerImpl, because the
|reverse_on_redirect| out parameter is used from the
NavigationControllerImpl code.

This CL is intended to be pure refactoring and should introduce no
behavior changes.  This is followup from discussion in r735048.

Bug: 1029161
Change-Id: I4d4322495604d7d67ddf22668eeab33c70fe0cf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993724
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735175}
2020-01-25 00:40:42 +00:00
Camille Lamy
2baa802799 Don't rewrite subframe navigation URLs
This CL makes sure we do not attempt to rewrite a subframe navigation URL in
should only be performed on main frame navigations.

NavigationControllerImpl: :CreateNavigationRequestFromLoadParams. Rewrites
Bug: 895065, 803859, 896028
Change-Id: I2a2326d802b55655d59f0c6d3d73e3060c58152b
Reviewed-on: https://chromium-review.googlesource.com/c/1282992
Commit-Queue: Charlie Reis <creis@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601183}
2018-10-19 16:43:17 +00:00
avi
b7348940d3 Switch to standard integer types in content/browser/.
BUG=138542
TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1549113002

Cr-Commit-Position: refs/heads/master@{#366868}
2015-12-25 20:58:00 +00:00
olli.raula
36aa8be4eb Move Singleton and related structs to namespace base
Public APIs from base should live inside base:: so moved Singleton class
and structs to base{} and fixed consumers.

also fixed:

** Presubmit ERRORS **
Found Singleton<T> in the following header files.
Please move them to an appropriate source file so that the template
gets instantiated in a single compilation unit.
  chrome/browser/plugins/plugin_finder.h \
  chromecast/media/base/media_message_loop.h \
  content/browser/media/android/media_drm_credential_manager.h

Presubmit warnings:
src/chrome/browser/extensions/warning_badge_service_factory.h:5:
  #ifndef header guard has wrong style, please use:
  CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_
  [build/header_guard] [5]
src/chrome/browser/extensions/warning_badge_service_factory.h:39:
  #endif line should be "#endif  //
  CHROME_BROWSER_EXTENSIONS_WARNING_BADGE_SERVICE_FACTORY_H_"
  [build/header_guard] [5]

TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/1308823002

Cr-Commit-Position: refs/heads/master@{#348136}
2015-09-10 11:15:10 +00:00
creis
94a977f6dc Move URL fixup to a preliminary phase that doesn't affect virtual URLs.
Uses BrowserURLHandler since this depends on components and can't
live in content.

BUG=449829
TEST=See bug for repro steps.

Review URL: https://codereview.chromium.org/923183003

Cr-Commit-Position: refs/heads/master@{#316923}
2015-02-18 23:51:40 +00:00
dcheng
c2282aa891 Standardize usage of virtual/override/final in content/browser/
This patch was automatically generated by applying clang fixit hints
generated by the plugin to the source tree.

BUG=417463
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/667943003

Cr-Commit-Position: refs/heads/master@{#300469}
2014-10-21 12:08:25 +00:00
sgurun
d8e1571cb9 Add a unit test for viewsource reverse writer handler
The reverse writer for viewsource had an incorrect assumption about the path component of URL which was causing a duplication of query and fragment parameters. This change is to unit test the fix that  went in
https://codereview.chromium.org/655023002/

BUG=336846

Review URL: https://codereview.chromium.org/659153003

Cr-Commit-Position: refs/heads/master@{#300281}
2014-10-20 16:59:42 +00:00
mohan.reddy
7fc3ac7d5a Replace FINAL and OVERRIDE with their C++11 counterparts in content
This step is a giant search and replace for OVERRIDE and FINAL to
replace them with their lowercase versions.

BUG=417463

Review URL: https://codereview.chromium.org/637183002

Cr-Commit-Position: refs/heads/master@{#298804}
2014-10-09 05:24:24 +00:00
jam@chromium.org
464883218e Move remaining files in content\browser to the content namespace.
Review URL: https://codereview.chromium.org/11340029

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164828 0039d316-1c4b-4281-b951-d872f2087c98
2012-10-30 03:22:20 +00:00
sail@chromium.org
d9c2e51c51 Revert 164120 - content/browser: Move more files into the content namespace.
Fixed most of the files found with the following command line:

$ git grep --files-without-match --name-only "namespace content {" -- content/browser/{*.cc,*.h.*.mm}

R=jam@chromium.org

Review URL: https://codereview.chromium.org/11274038

TBR=tfarina@chromium.org
Review URL: https://codereview.chromium.org/11273049

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164122 0039d316-1c4b-4281-b951-d872f2087c98
2012-10-25 18:54:36 +00:00
tfarina@chromium.org
7a91c555f3 content/browser: Move more files into the content namespace.
Fixed most of the files found with the following command line:

$ git grep --files-without-match --name-only "namespace content {" -- content/browser/{*.cc,*.h.*.mm}

R=jam@chromium.org

Review URL: https://codereview.chromium.org/11274038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164120 0039d316-1c4b-4281-b951-d872f2087c98
2012-10-25 18:44:52 +00:00
ajwong@chromium.org
f78671752a Remove #pragma once from content
Review URL: https://chromiumcodereview.appspot.com/10696166

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146071 0039d316-1c4b-4281-b951-d872f2087c98
2012-07-11 07:04:07 +00:00
jam@chromium.org
825b16687e Add a Content API around BrowserURLHandler.
BUG=98716
Review URL: https://chromiumcodereview.appspot.com/9688019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126180 0039d316-1c4b-4281-b951-d872f2087c98
2012-03-12 19:07:31 +00:00