Skip to content

Commit

Permalink
Merge pull request #17252 from brave/enable_sharing-desktop-screenshots
Browse files Browse the repository at this point in the history
Enabled desktop screenshot feature by default
  • Loading branch information
simonhong authored Feb 16, 2023
2 parents 09b18ce + 7cf07f9 commit 77f348d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/brave_main_delegate_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "android_webview/common/aw_features.h"
#include "chrome/test/base/android/android_browser_test.h"
#else
#include "chrome/browser/sharing_hub/sharing_hub_features.h"
#include "chrome/browser/ui/profile_picker.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/test/base/in_process_browser_test.h"
Expand Down Expand Up @@ -211,6 +212,9 @@ IN_PROC_BROWSER_TEST_F(BraveMainDelegateBrowserTest, EnabledFeatures) {
&blink::features::kReduceUserAgentMinorVersion,
#if BUILDFLAG(IS_WIN)
&features::kWinrtGeolocationImplementation,
#endif
#if !BUILDFLAG(IS_ANDROID)
&sharing_hub::kDesktopScreenshots,
#endif
&media::kEnableTabMuting,
&net::features::kPartitionConnectionsByNetworkIsolationKey,
Expand Down
16 changes: 16 additions & 0 deletions chromium_src/chrome/browser/sharing_hub/sharing_hub_features.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* Copyright (c) 2023 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 https://mozilla.org/MPL/2.0/. */

#include "src/chrome/browser/sharing_hub/sharing_hub_features.cc"

#include "base/feature_override.h"

namespace sharing_hub {

OVERRIDE_FEATURE_DEFAULT_STATES({{
{kDesktopScreenshots, base::FEATURE_ENABLED_BY_DEFAULT},
}});

} // namespace sharing_hub
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Copyright (c) 2023 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 https://mozilla.org/MPL/2.0/. */

#include <string>

#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "components/download/public/common/download_url_parameters.h"
#include "url/gurl.h"

namespace {

std::u16string GetBraveFilenameForURL(const GURL& url) {
if (!url.has_host() || url.HostIsIPAddress()) {
return u"brave_screenshot.png";
}

return base::ASCIIToUTF16(
base::StrCat({"brave_screenshot_", url.host_piece(), ".png"}));
}

} // namespace

#define set_suggested_name(...) \
set_suggested_name( \
GetBraveFilenameForURL(web_contents_->GetLastCommittedURL()))

#include "src/chrome/browser/ui/views/sharing_hub/screenshot/screenshot_captured_bubble.cc"

#undef set_suggested_name

0 comments on commit 77f348d

Please sign in to comment.