Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove javascript icon from location bar #7148

Merged
merged 1 commit into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions browser/ui/content_settings/brave_content_setting_image_models.cc
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/ui/content_settings/brave_content_setting_image_models.h"

#include "base/ranges/algorithm.h"
#include "brave/browser/ui/content_settings/brave_autoplay_blocked_image_model.h"
#include "third_party/widevine/cdm/buildflags.h"

using ImageType = ContentSettingImageModel::ImageType;

void BraveGenerateContentSettingImageModels(
std::vector<std::unique_ptr<ContentSettingImageModel>>& result) {
// Remove the cookies content setting image model
std::vector<std::unique_ptr<ContentSettingImageModel>>* result) {
// Remove the cookies and javascript content setting image model
// https://github.com/brave/brave-browser/issues/1197
// TODO(iefremov): This changes break internal image models ordering which is
// based on enum values. This breaks tests and probably should be fixed
// (by adding more diff of course).
for (size_t i = 0; i < result.size(); i++) {
if (result[i]->image_type() ==
ContentSettingImageModel::ImageType::COOKIES) {
result.erase(result.begin() + i);
break;
}
}
// https://github.com/brave/brave-browser/issues/199
result->erase(
base::ranges::remove_if(*result,
diracdeltas marked this conversation as resolved.
Show resolved Hide resolved
[](const auto& m) {
return m->image_type() == ImageType::COOKIES ||
m->image_type() == ImageType::JAVASCRIPT;
}),
result->end());

result.push_back(std::make_unique<BraveAutoplayBlockedImageModel>());
result->push_back(std::make_unique<BraveAutoplayBlockedImageModel>());
}
10 changes: 8 additions & 2 deletions browser/ui/content_settings/brave_content_setting_image_models.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_BROWSER_UI_CONTENT_SETTINGS_BRAVE_CONTENT_SETTING_IMAGE_MODELS_H_
#define BRAVE_BROWSER_UI_CONTENT_SETTINGS_BRAVE_CONTENT_SETTING_IMAGE_MODELS_H_

#include <memory>
#include <vector>

class ContentSettingImageModel;

void BraveGenerateContentSettingImageModels(
std::vector<std::unique_ptr<ContentSettingImageModel>>&);
std::vector<std::unique_ptr<ContentSettingImageModel>>*);

#endif // BRAVE_BROWSER_UI_CONTENT_SETTINGS_BRAVE_CONTENT_SETTING_IMAGE_MODELS_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "chrome/browser/ui/content_settings/content_setting_image_model.h"

#include "brave/browser/ui/content_settings/brave_content_setting_image_models.h"

#define GenerateContentSettingImageModels \
GenerateContentSettingImageModels_ChromiumImpl
#include "../../../../../../chrome/browser/ui/content_settings/content_setting_image_model.cc"
#undef GenerateContentSettingImageModels

std::vector<std::unique_ptr<ContentSettingImageModel>>
ContentSettingImageModel::GenerateContentSettingImageModels() {
std::vector<std::unique_ptr<ContentSettingImageModel>> result =
GenerateContentSettingImageModels_ChromiumImpl();
BraveGenerateContentSettingImageModels(&result);
return result;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_

#define GenerateContentSettingImageModels \
GenerateContentSettingImageModels_ChromiumImpl(); \
static std::vector<std::unique_ptr<ContentSettingImageModel>> \
GenerateContentSettingImageModels

#include "../../../../../../chrome/browser/ui/content_settings/content_setting_image_model.h"
#undef GenerateContentSettingImageModels

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTING_IMAGE_MODEL_H_

This file was deleted.