Skip to content

Commit

Permalink
[live-preview] Add a new enum case to PreviewType of value kCameraAndMic
Browse files Browse the repository at this point in the history
This is needed for a dependant CL --> https://crrev.com/c/5379350

Bug: b:329311590
Change-Id: I2830571bae34eea77f41364c2ca46277da07d5aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5384605
Commit-Queue: Ahmed Moussa <[email protected]>
Reviewed-by: Bryant Chandler <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1276940}
  • Loading branch information
ahmedmoussa authored and Chromium LUCI CQ committed Mar 22, 2024
1 parent 48611e0 commit 7755ef2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
17 changes: 16 additions & 1 deletion chrome/browser/ui/views/media_preview/media_coordinator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>

#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/media_preview/media_preview_metrics.h"
#include "chrome/browser/ui/views/media_preview/media_view.h"
#include "ui/color/color_id.h"
#include "ui/views/background.h"
Expand Down Expand Up @@ -82,3 +81,19 @@ void MediaCoordinator::UpdateDevicePreferenceRanking() {
mic_coordinator_->UpdateDevicePreferenceRanking();
}
}

namespace media_coordinator {

media_preview_metrics::PreviewType GetPreviewTypeFromMediaCoordinatorViewType(
MediaCoordinator::ViewType view_type) {
switch (view_type) {
case MediaCoordinator::ViewType::kBoth:
return media_preview_metrics::PreviewType::kCameraAndMic;
case MediaCoordinator::ViewType::kCameraOnly:
return media_preview_metrics::PreviewType::kCamera;
case MediaCoordinator::ViewType::kMicOnly:
return media_preview_metrics::PreviewType::kMic;
}
}

} // namespace media_coordinator
12 changes: 8 additions & 4 deletions chrome/browser/ui/views/media_preview/media_coordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
#include <string>

#include "chrome/browser/ui/views/media_preview/camera_preview/camera_coordinator.h"
#include "chrome/browser/ui/views/media_preview/media_preview_metrics.h"
#include "chrome/browser/ui/views/media_preview/mic_preview/mic_coordinator.h"
#include "components/prefs/pref_service.h"

namespace media_preview_metrics {
struct Context;
} // namespace media_preview_metrics

namespace views {
class View;
} // namespace views
Expand Down Expand Up @@ -59,4 +56,11 @@ class MediaCoordinator {
std::optional<MicCoordinator> mic_coordinator_;
};

namespace media_coordinator {

media_preview_metrics::PreviewType GetPreviewTypeFromMediaCoordinatorViewType(
MediaCoordinator::ViewType view_type);

} // namespace media_coordinator

#endif // CHROME_BROWSER_UI_VIEWS_MEDIA_PREVIEW_MEDIA_COORDINATOR_H_
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ std::optional<std::string> MapContextToString(
namespace media_preview_metrics {

Context::Context(UiLocation ui_location) : ui_location(ui_location) {}
Context::Context(UiLocation ui_location, PreviewType preview_type)
: ui_location(ui_location), preview_type(preview_type) {}
Context::~Context() = default;

void RecordPageInfoCameraNumInUseDevices(int devices) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
namespace media_preview_metrics {

enum class UiLocation { kPermissionPrompt, kPageInfo };
enum class PreviewType { kUnknown, kCamera, kMic };
enum class PreviewType { kUnknown, kCamera, kMic, kCameraAndMic };

struct Context {
explicit Context(UiLocation ui_location);
Context(UiLocation ui_location, PreviewType preview_type);
~Context();

const UiLocation ui_location;
Expand Down

0 comments on commit 7755ef2

Please sign in to comment.