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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1917073002: Block webpages from navigating to view-source URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Delete layout tests Created 4 years, 7 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: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index e61c79084d804712fa773b8bb3aefedb3ed21fbb..9046e0951d5aaaa462f6f07b5d866aa4a3925230 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -463,58 +463,6 @@ void FocusFrame(FrameTreeNode* frame) {
focus_observer.Wait();
}
-// A WebContentsDelegate that catches messages sent to the console.
-class ConsoleObserverDelegate : public WebContentsDelegate {
- public:
- ConsoleObserverDelegate(WebContents* web_contents, const std::string& filter)
- : web_contents_(web_contents),
- filter_(filter),
- message_(""),
- message_loop_runner_(new MessageLoopRunner) {}
-
- ~ConsoleObserverDelegate() override {}
-
- bool AddMessageToConsole(WebContents* source,
- int32_t level,
- const base::string16& message,
- int32_t line_no,
- const base::string16& source_id) override;
-
- std::string message() { return message_; }
-
- void Wait();
-
- private:
- WebContents* web_contents_;
- std::string filter_;
- std::string message_;
-
- // The MessageLoopRunner used to spin the message loop.
- scoped_refptr<MessageLoopRunner> message_loop_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(ConsoleObserverDelegate);
-};
-
-void ConsoleObserverDelegate::Wait() {
- message_loop_runner_->Run();
-}
-
-bool ConsoleObserverDelegate::AddMessageToConsole(
- WebContents* source,
- int32_t level,
- const base::string16& message,
- int32_t line_no,
- const base::string16& source_id) {
- DCHECK(source == web_contents_);
-
- std::string ascii_message = base::UTF16ToASCII(message);
- if (base::MatchPattern(ascii_message, filter_)) {
- message_ = ascii_message;
- message_loop_runner_->Quit();
- }
- return false;
-}
-
// A BrowserMessageFilter that drops SwapOut ACK messages.
class SwapoutACKMessageFilter : public BrowserMessageFilter {
public:

Powered by Google App Engine
This is Rietveld 408576698