Skip to content
Open
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
19 changes: 0 additions & 19 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,25 +137,6 @@ steps:
- replayio/buildevents#adb8a05: ~
command: "be_cmd metabase-tests -- /home/ubuntu/chromium/src/replay_build_scripts/metabase.sh"

- label: "Trigger Devtools E2E Tests"
key: "devtools-test-suite"
soft_fail: true
depends_on: "build-chromium-linux-x86_64"
agents:
- "runtimeType=chromiumbuild"
- "os=linux"
- "queue=runtime"
plugins:
- thedyrt/skip-checkout#v0.1.1: ~
- seek-oss/aws-sm#v2.3.1:
region: us-east-2
env:
GITHUB_AUTH_SECRET: "prod/devtools-github-secret"
BUILDEVENT_APIKEY: honeycomb-api-key
BUILDEVENT_BUILDKITE_API_TOKEN: buildkite-api-token-honeycomb-build-events
- replayio/buildevents#adb8a05: ~
command: "be_cmd devtools-tests -- /home/ubuntu/chromium/src/replay_build_scripts/devtools-tests.sh"

# wait for all steps above, but also continue if they fail
- wait: ~
continue_on_failure: true
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ static_library("browser") {
"//components/query_tiles",
"//components/reading_list/core",
"//components/reading_list/features:flags",
"//components/record_replay/services/auth_token:lib",
"//components/record_replay/services/record_replay:lib",
"//components/reduce_accept_language/browser:browser",
"//components/renderer_context_menu",
"//components/reporting/client:report_queue",
Expand Down
16 changes: 8 additions & 8 deletions chrome/browser/chrome_browser_interface_binders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
#include "components/performance_manager/public/performance_manager.h"
#include "components/prefs/pref_service.h"
#include "components/reading_list/features/reading_list_switches.h"
#include "components/record_replay/services/auth_token/public/mojom/auth_token.mojom.h"
#include "components/record_replay/services/auth_token/public/cpp/auth_token_service_factory.h"
#include "components/record_replay/services/record_replay/public/mojom/record_replay.mojom.h"
#include "components/record_replay/services/record_replay/public/cpp/record_replay_service_factory.h"
#include "components/safe_browsing/buildflags.h"
#include "components/security_state/content/content_utils.h"
#include "components/security_state/core/security_state.h"
Expand Down Expand Up @@ -374,9 +374,9 @@ namespace internal {

using content::RegisterWebUIControllerInterfaceBinder;

void BindRecordReplayAuthTokenStore(
void BindRecordReplayService(
content::RenderFrameHost* frame_host,
mojo::PendingReceiver<auth_token::mojom::RecordReplayAuthTokenStore> receiver) {
mojo::PendingReceiver<record_replay::mojom::RecordReplayService> receiver) {

// we only bind the receiver if the frame's origin is app.replay.io
if (frame_host->GetLastCommittedOrigin().host() != "app.replay.io") {
Expand All @@ -386,8 +386,8 @@ void BindRecordReplayAuthTokenStore(
content::BrowserContext* browser_context =
frame_host->GetProcess()->GetBrowserContext();

auth_token::RecordReplayAuthTokenServiceFactory::GetForBrowserContext(browser_context)
->BindAuthTokenStore(std::move(receiver));
record_replay::RecordReplayServiceFactory::GetForBrowserContext(browser_context)
->BindRecordReplayService(std::move(receiver));
}

#if BUILDFLAG(ENABLE_UNHANDLED_TAP)
Expand Down Expand Up @@ -696,8 +696,8 @@ void PopulateChromeFrameBinders(
mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
content::RenderFrameHost* render_frame_host) {

map->Add<auth_token::mojom::RecordReplayAuthTokenStore>(
base::BindRepeating(&BindRecordReplayAuthTokenStore));
map->Add<record_replay::mojom::RecordReplayService>(
base::BindRepeating(&BindRecordReplayService));

map->Add<image_annotation::mojom::Annotator>(
base::BindRepeating(&BindImageAnnotator));
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/prefs/browser_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <string>

#include "base/record_replay.h"
#include "base/trace_event/trace_event.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
Expand Down Expand Up @@ -134,6 +135,7 @@
#include "components/prefs/pref_service.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/record_replay/services/record_replay/public/cpp/record_replay_service.h"
#include "components/safe_browsing/content/common/file_type_policies_prefs.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/search_engines/template_url_prepopulate_data.h"
Expand Down Expand Up @@ -1559,6 +1561,9 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
RegisterBrowserViewProfilePrefs(registry);
#endif

// Register record-replay prefs dictionary.
record_replay::RegisterProfilePrefs(registry);

#if !BUILDFLAG(IS_ANDROID)
registry->RegisterBooleanPref(
prefs::kLensRegionSearchEnabled, true,
Expand Down
24 changes: 23 additions & 1 deletion chrome/browser/ui/views/toolbar/record_replay_toolbar_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/webui_url_constants.h"
#include "components/record_replay/services/record_replay/public/cpp/record_replay_service.h"
#include "components/record_replay/services/record_replay/public/cpp/record_replay_service_factory.h"
#include "ui/views/controls/button/button_controller.h"
#include "content/public/browser/web_contents_observer.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
Expand Down Expand Up @@ -90,6 +92,18 @@ void RecordReplayToolbarButton::ButtonPressed() {
}

void RecordReplayToolbarButton::StartRecording() {
// TODO: Check for record-replay API key here.
// If it's not set, then we shouldn't have reached this location
// in the logic.
auto* service = GetRecordReplayService();
fprintf(stderr, "KVKV: RecordReplayToolbarButton::StartRecording(): svc=%p\n", service);
absl::optional<std::string> token = service->GetReplayUserToken();
if (!token.has_value()) {
fprintf(stderr, "KVKV: RecordReplayToolbarButton::StartRecording(): no token\n");
} else {
fprintf(stderr, "KVKV: RecordReplayToolbarButton::StartRecording(): token=%s\n", token.value().c_str());
}

// Get the current active tab. This provides the URL we'll be recording.
TabStripModel* tab_strip_model = browser_->tab_strip_model();
content::WebContents* old_web_contents = tab_strip_model->GetActiveWebContents();
Expand All @@ -105,6 +119,7 @@ void RecordReplayToolbarButton::StartRecording() {
CHECK(!web_contents_observer_.get());
content::WebContents::CreateParams new_params(browser_context);
new_params.record_replay_for_recording = true;

std::unique_ptr<content::WebContents> new_web_contents(
content::WebContents::Create(new_params));
web_contents_ = new_web_contents.get();
Expand Down Expand Up @@ -162,6 +177,13 @@ void RecordReplayToolbarButton::RecordingTabDestroyed() {
RefreshIconState();
}

record_replay::RecordReplayService*
RecordReplayToolbarButton::GetRecordReplayService() const {
return record_replay::RecordReplayServiceFactory::GetForBrowserContext(
browser_->profile()
);
}

void RecordReplayToolbarButton::RefreshIconState() {
if (web_contents_) {
SetVectorIcons(kRecordReplayStopIcon, kRecordReplayStopIcon);
Expand All @@ -185,4 +207,4 @@ void RecordReplayToolbarButton::EnsurePostRecordingWebContents() {
post_recording_web_contents_->GetController().LoadURL(url, content::Referrer(),
ui::PAGE_TRANSITION_TYPED,
std::string());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
#include "content/public/browser/web_contents.h"

class Browser;
class Profile;

namespace record_replay {
class RecordReplayService;
}

struct RecordReplayToolbarButtonWebContentsObserver;

Expand All @@ -31,6 +36,8 @@ class RecordReplayToolbarButton: public ToolbarButton {
void RefreshIconState();
void EnsurePostRecordingWebContents();

record_replay::RecordReplayService* GetRecordReplayService() const;

const raw_ptr<Browser> browser_;
content::WebContents* web_contents_;
content::WebContents* post_recording_web_contents_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/record_replay_driver.h"
#include "chrome/browser/ui/webui/record_replay/record_replay_manager_handler.h"
#include "components/record_replay/services/auth_token/public/cpp/auth_token_service_factory.h"
#include "components/record_replay/services/record_replay/public/cpp/record_replay_service_factory.h"
#include <string>

#include "base/bind.h"
Expand All @@ -17,82 +16,48 @@
RecordReplayManagerHandler::RecordReplayManagerHandler(
Profile* profile,
mojo::PendingReceiver<mojom::RecordReplayManagerHandler> receiver)
: profile_(profile), receiver_(this, std::move(receiver)) {
}
: profile_(profile),
service_(record_replay::RecordReplayServiceFactory::GetForBrowserContext(profile_)),
receiver_(this, std::move(receiver))
{}

RecordReplayManagerHandler::~RecordReplayManagerHandler() = default;

void RecordReplayManagerHandler::SetManager(
mojo::PendingRemote<mojom::RecordReplayManager> manager) {
manager_.Bind(std::move(manager));
manager_->HandleSignInButtonClicked();
}

void RecordReplayManagerHandler::HandleSignInButtonClicked() {
fprintf(stderr, "RecordReplay [RUN-2866] ManagerHandler(%p)::HandleSignInButtonClicked()\n", this);
CHECK(manager_)
<< ("RecordReplayManagerHandler::HandleSignInButtonClicked called"
" before manager was set");
manager_->HandleSignInButtonClicked();
// auth_token::RecordReplayAuthTokenServiceFactory::GetForBrowserContext(profile_)->SetToken(api_key);
}

void RecordReplayManagerHandler::GetEnv(const std::string& key, GetEnvCallback callback) {
std::move(callback).Run(absl::optional<std::string>());
std::move(callback).Run(service_->GetEnv(key));
}
void RecordReplayManagerHandler::GetBuildId(GetBuildIdCallback callback) {
std::move(callback).Run(RECORD_REPLAY_BUILD_ID);
std::move(callback).Run(service_->GetBuildId());
}
void RecordReplayManagerHandler::GetReplayUserToken(GetReplayUserTokenCallback callback) {
std::move(callback).Run(record_replay_user_token_);
std::move(callback).Run(service_->GetReplayUserToken());
}
void RecordReplayManagerHandler::SetReplayUserToken(const absl::optional<std::string>& token) {
record_replay_user_token_ = token;
service_->SetReplayUserToken(token);
}
void RecordReplayManagerHandler::GetReplayRefreshToken(GetReplayRefreshTokenCallback callback) {
std::move(callback).Run(record_replay_refresh_token_);
std::move(callback).Run(service_->GetReplayRefreshToken());
}
void RecordReplayManagerHandler::SetReplayRefreshToken(const absl::optional<std::string>& token) {
record_replay_refresh_token_ = token;
service_->SetReplayRefreshToken(token);
}
void RecordReplayManagerHandler::ShowAuthenticationError(const std::string& message) {
fprintf(stderr, "RecordReplay [RUN-2866] ManagerHandler(%p)::ShowAuthenticationError(%s)\n", this,
message.c_str());
}

#if BUILDFLAG(IS_MAC)
static void OpenExternalBrowserMac(const std::string& url_str) {
CFURLRef url = CFURLCreateWithBytes (
NULL, // allocator
(UInt8*)url_str.c_str(), // URLBytes
url_str.length(), // length
kCFStringEncodingASCII, // encoding
NULL // baseURL
);
LSOpenCFURLRef(url,0);
CFRelease(url);
}
#endif

#if BUILDFLAG(IS_LINUX)
static void OpenExternalBrowserLinux(const std::string& url_str) {
std::string cmd = "xdg-open '" + url_str + "'";
int result = system(cmd.c_str());
if (result != 0) {
fprintf(stderr, "RecordReplayManagerHandler::OpenExternalBrowserLinux() failed with %d\n",
result);
}
service_->ShowAuthenticationError(message);
}
#endif

#if BUILDFLAG(IS_WIN)
static void OpenExternalBrowserWindows(const std::string& url_str) {
fprintf(stderr, "RecordReplayManagerHandler::OpenExternalBrowserWindows() NOT IMPLEMENTED\n");
}
#endif

void RecordReplayManagerHandler::OpenExternalBrowser(const std::string& url) {
#if BUILDFLAG(IS_MAC)
OpenExternalBrowserMac(url);
#elif BUILDFLAG(IS_LINUX)
OpenExternalBrowserLinux(url);
#elif BUILDFLAG(IS_WIN)
OpenExternalBrowserWindows(url);
#endif
service_->OpenExternalBrowser(url);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
class AutocompleteController;
class Profile;

namespace record_replay {
class RecordReplayService;
}

// Implementation of mojo::RecordReplayManagerHandler. StartOmniboxQuery() calls to a
// private AutocompleteController. It also listens for updates from the
// AutocompleteController to OnResultChanged() and passes those results to
Expand Down Expand Up @@ -60,6 +64,9 @@ class RecordReplayManagerHandler : public mojom::RecordReplayManagerHandler {
// The Profile* handed to us in our constructor.
raw_ptr<Profile> profile_;

// Handle to the component service for record replay.
raw_ptr<record_replay::RecordReplayService> service_;

mojo::Receiver<mojom::RecordReplayManagerHandler> receiver_;

base::WeakPtrFactory<RecordReplayManagerHandler> weak_factory_{this};
Expand Down

This file was deleted.

This file was deleted.

Loading