Commit 618a22f7 authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Wire Up ScreenCaptureNotificationUIViews to the Cocoa Browser

BUG=728163

Change-Id: Ib519ec4a7ee122301c1ff17dc2f76cf66e48e465
Reviewed-on: https://chromium-review.googlesource.com/932014
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#541999}
parent 1ae3213f
...@@ -3273,7 +3273,6 @@ split_static_library("ui") { ...@@ -3273,7 +3273,6 @@ split_static_library("ui") {
"views/profiles/forced_reauthentication_dialog_view.h", "views/profiles/forced_reauthentication_dialog_view.h",
"views/profiles/signin_view_controller_delegate_views.cc", "views/profiles/signin_view_controller_delegate_views.cc",
"views/profiles/signin_view_controller_delegate_views.h", "views/profiles/signin_view_controller_delegate_views.h",
"views/screen_capture_notification_ui_views.cc",
"views/sync/one_click_signin_dialog_view.cc", "views/sync/one_click_signin_dialog_view.cc",
"views/sync/one_click_signin_dialog_view.h", "views/sync/one_click_signin_dialog_view.h",
"views/touch_uma/touch_uma.cc", "views/touch_uma/touch_uma.cc",
...@@ -3346,6 +3345,7 @@ split_static_library("ui") { ...@@ -3346,6 +3345,7 @@ split_static_library("ui") {
"views/relaunch_notification/relaunch_recommended_bubble_view.h", "views/relaunch_notification/relaunch_recommended_bubble_view.h",
"views/relaunch_notification/relaunch_required_dialog_view.cc", "views/relaunch_notification/relaunch_required_dialog_view.cc",
"views/relaunch_notification/relaunch_required_dialog_view.h", "views/relaunch_notification/relaunch_required_dialog_view.h",
"views/screen_capture_notification_ui_views.cc",
] ]
if (is_mac) { if (is_mac) {
sources += [ sources += [
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "chrome/browser/ui/cocoa/browser_dialogs_views_mac.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h" #include "chrome/grit/theme_resources.h"
#include "skia/ext/skia_utils_mac.h" #include "skia/ext/skia_utils_mac.h"
...@@ -69,17 +70,13 @@ gfx::NativeViewId ScreenCaptureNotificationUICocoa::OnStarted( ...@@ -69,17 +70,13 @@ gfx::NativeViewId ScreenCaptureNotificationUICocoa::OnStarted(
std::unique_ptr<ScreenCaptureNotificationUI> std::unique_ptr<ScreenCaptureNotificationUI>
ScreenCaptureNotificationUI::CreateCocoa(const base::string16& text) { ScreenCaptureNotificationUI::CreateCocoa(const base::string16& text) {
if (chrome::ShowAllDialogsWithViewsToolkit())
return nullptr;
return std::unique_ptr<ScreenCaptureNotificationUI>( return std::unique_ptr<ScreenCaptureNotificationUI>(
new ScreenCaptureNotificationUICocoa(text)); new ScreenCaptureNotificationUICocoa(text));
} }
#if !BUILDFLAG(MAC_VIEWS_BROWSER)
std::unique_ptr<ScreenCaptureNotificationUI>
ScreenCaptureNotificationUI::Create(const base::string16& text) {
return CreateCocoa(text);
}
#endif
@implementation ScreenCaptureNotificationController @implementation ScreenCaptureNotificationController
- (id)initWithCallback:(const base::Closure&)stop_callback - (id)initWithCallback:(const base::Closure&)stop_callback
text:(const base::string16&)text { text:(const base::string16&)text {
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_SCREEN_CAPTURE_NOTIFICATION_UI_H_ #define CHROME_BROWSER_UI_SCREEN_CAPTURE_NOTIFICATION_UI_H_
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/common/media_stream_request.h" #include "content/public/common/media_stream_request.h"
...@@ -14,18 +15,23 @@ ...@@ -14,18 +15,23 @@
// is being captured. // is being captured.
class ScreenCaptureNotificationUI : public content::MediaStreamUI { class ScreenCaptureNotificationUI : public content::MediaStreamUI {
public: public:
~ScreenCaptureNotificationUI() override {} ScreenCaptureNotificationUI() = default;
~ScreenCaptureNotificationUI() override = default;
// Creates platform-specific screen capture notification UI. |text| specifies // Creates platform-specific screen capture notification UI. |text| specifies
// the text that should be shown in the notification. // the text that should be shown in the notification.
static std::unique_ptr<ScreenCaptureNotificationUI> Create( static std::unique_ptr<ScreenCaptureNotificationUI> Create(
const base::string16& text); const base::string16& text);
private:
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// Temporary shim for Polychrome. See bottom of first comment in // Returns a ScreenCaptureNotificationUI or nullptr if the Views version
// https://crbug.com/80495 for details. // should be used instead.
static std::unique_ptr<ScreenCaptureNotificationUI> CreateCocoa( static std::unique_ptr<ScreenCaptureNotificationUI> CreateCocoa(
const base::string16& text); const base::string16& text);
#endif #endif
DISALLOW_COPY_AND_ASSIGN(ScreenCaptureNotificationUI);
}; };
#endif // CHROME_BROWSER_UI_SCREEN_CAPTURE_NOTIFICATION_UI_H_ #endif // CHROME_BROWSER_UI_SCREEN_CAPTURE_NOTIFICATION_UI_H_
...@@ -329,8 +329,9 @@ void ScreenCaptureNotificationUIViews::NotifyStopped() { ...@@ -329,8 +329,9 @@ void ScreenCaptureNotificationUIViews::NotifyStopped() {
std::unique_ptr<ScreenCaptureNotificationUI> std::unique_ptr<ScreenCaptureNotificationUI>
ScreenCaptureNotificationUI::Create(const base::string16& text) { ScreenCaptureNotificationUI::Create(const base::string16& text) {
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
if (views_mode_controller::IsViewsBrowserCocoa()) std::unique_ptr<ScreenCaptureNotificationUI> cocoa_ui = CreateCocoa(text);
return CreateCocoa(text); if (cocoa_ui)
return cocoa_ui;
#endif #endif
return std::unique_ptr<ScreenCaptureNotificationUI>( return std::unique_ptr<ScreenCaptureNotificationUI>(
new ScreenCaptureNotificationUIViews(text)); new ScreenCaptureNotificationUIViews(text));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment