Commit bab14069 authored by Robert Sesek's avatar Robert Sesek Committed by Commit Bot

mac: Delete Cocoa extensions.

Bug: 832676
Change-Id: I1a7c9f0834789bbf67692edcd5317d0487905b9f
Reviewed-on: https://chromium-review.googlesource.com/1241713Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593728}
parent e7aa5e57
......@@ -88,7 +88,7 @@
<action selector="commandDispatch:" target="-1" id="24"/>
</connections>
</textField>
<customView hidden="YES" id="144" userLabel="Browser Actions Container" customClass="BrowserActionsContainerView">
<customView hidden="YES" id="144" userLabel="Browser Actions Container">
<rect key="frame" x="572" y="4" width="0.0" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
</customView>
......
......@@ -92,17 +92,6 @@
</if>
<structure type="chrome_scaled_image" name="IDR_COOKIES" file="common/cookies.png" />
<structure type="chrome_scaled_image" name="IDR_COOKIE_STORAGE_ICON" file="common/cookie_storage.png" />
<if expr="is_macosx">
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_LEFT" file="common/developer_mode_highlight_bottom_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM" file="common/developer_mode_highlight_bottom.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_BOTTOM_RIGHT" file="common/developer_mode_highlight_bottom_right.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_CENTER" file="common/developer_mode_highlight_center.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_LEFT" file="common/developer_mode_highlight_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_RIGHT" file="common/developer_mode_highlight_right.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_LEFT" file="common/developer_mode_highlight_top_left.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP" file="common/developer_mode_highlight_top.png" />
<structure type="chrome_scaled_image" name="IDR_DEVELOPER_MODE_HIGHLIGHT_TOP_RIGHT" file="common/developer_mode_highlight_top_right.png" />
</if>
<if expr="chromeos">
<structure type="chrome_scaled_image" name="IDR_DEVICE_DISABLED" file="cros/device_disabled.png" />
</if>
......
......@@ -122,20 +122,8 @@ jumbo_split_static_library("ui") {
"cocoa/draggable_button.mm",
"cocoa/draggable_button_mixin.h",
"cocoa/draggable_button_mixin.mm",
"cocoa/extensions/browser_action_button.h",
"cocoa/extensions/browser_action_button.mm",
"cocoa/extensions/browser_actions_container_view.h",
"cocoa/extensions/browser_actions_container_view.mm",
"cocoa/extensions/browser_actions_controller.h",
"cocoa/extensions/browser_actions_controller.mm",
"cocoa/extensions/extension_action_platform_delegate_cocoa.h",
"cocoa/extensions/extension_action_platform_delegate_cocoa.mm",
"cocoa/extensions/extension_keybinding_registry_cocoa.h",
"cocoa/extensions/extension_keybinding_registry_cocoa.mm",
"cocoa/extensions/extension_popup_views_mac.h",
"cocoa/extensions/extension_popup_views_mac.mm",
"cocoa/extensions/toolbar_actions_bar_bubble_views_presenter.h",
"cocoa/extensions/toolbar_actions_bar_bubble_views_presenter.mm",
"cocoa/fast_resize_view.h",
"cocoa/fast_resize_view.mm",
"cocoa/floating_bar_backing_view.h",
......@@ -3819,9 +3807,6 @@ static_library("test_support") {
"views/webauthn/authenticator_request_dialog_view_test_api.cc",
"views/webauthn/authenticator_request_dialog_view_test_api.h",
]
if (is_mac) {
sources += [ "cocoa/extensions/browser_action_test_util_views_cocoa.mm" ]
}
if (use_aura) {
sources += [ "views/toolbar/browser_action_test_util_views_aura.cc" ]
deps += [
......
......@@ -35,7 +35,6 @@
#import "chrome/browser/ui/cocoa/browser_window_utils.h"
#import "chrome/browser/ui/cocoa/chrome_event_processing_window.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#include "chrome/browser/ui/cocoa/key_equivalent_constants.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#import "chrome/browser/ui/cocoa/nsmenuitem_additions.h"
......@@ -438,9 +437,6 @@ void BrowserWindowCocoa::FocusToolbar() {
}
ToolbarActionsBar* BrowserWindowCocoa::GetToolbarActionsBar() {
if ([controller_ hasToolbar])
return [[[controller_ toolbarController] browserActionsController]
toolbarActionsBar];
return nullptr;
}
......
......@@ -350,11 +350,6 @@ bool IsTabDetachingInFullscreenEnabled() {
// Create the bridge for the status bubble.
statusBubble_ = new StatusBubbleMac([self window], self);
// This must be done after the view is added to the window since it relies
// on the window bounds to determine whether to show buttons or not.
if ([self hasToolbar]) // Do not create the buttons in popups.
[toolbarController_ createBrowserActionButtons];
extensionKeybindingRegistry_.reset(
new ExtensionKeybindingRegistryCocoa(browser_->profile(),
[self window],
......
......@@ -11,7 +11,6 @@
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#include "chrome/browser/ui/cocoa/browser_window_views_mac.h"
#import "chrome/browser/ui/cocoa/bubble_anchor_helper.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/extensions/extension_installed_bubble.h"
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_
#import <Cocoa/Cocoa.h>
#include <memory>
#import "base/mac/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/image_button_cell.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h"
@class BrowserActionsController;
@class MenuControllerCocoa;
class ToolbarActionViewController;
class ToolbarActionViewDelegateBridge;
// Fired on each drag event while the user is moving the button.
extern NSString* const kBrowserActionButtonDraggingNotification;
// Fired when the user drops the button.
extern NSString* const kBrowserActionButtonDragEndNotification;
@interface BrowserActionButton : ToolbarButtonCocoa<NSMenuDelegate> {
@private
// Used to move the button and query whether a button is currently animating.
base::scoped_nsobject<NSViewAnimation> moveAnimation_;
// The controller that handles most non-view logic.
ToolbarActionViewController* viewController_;
// The bridge between the view controller and this object.
std::unique_ptr<ToolbarActionViewDelegateBridge> viewControllerDelegate_;
// The context menu controller.
base::scoped_nsobject<MenuControllerCocoa> contextMenuController_;
// A substitute context menu to use in testing. We need this because normally
// menu code is blocking, making it difficult to test.
NSMenu* testContextMenu_;
// The controller for the browser actions bar that owns this button. Weak.
BrowserActionsController* browserActionsController_;
// Whether the button is currently being dragged.
BOOL isBeingDragged_;
// Drag events could be intercepted by other buttons, so to make sure that
// this is the only button moving if it ends up being dragged. This is set to
// YES upon |mouseDown:|.
BOOL dragCouldStart_;
// If a drag is not currently in progress, this is the point where the mouse
// down event occurred, and is used to prevent a drag from starting until it
// moves at least kMinimumDragDistance. Once a drag begins, this is the point
// at which the drag actually started.
NSPoint dragStartPoint_;
}
// Init the button with the frame. Does not own either |view_controller| or
// |controller|.
- (id)initWithFrame:(NSRect)frame
viewController:(ToolbarActionViewController*)viewController
controller:(BrowserActionsController*)controller;
- (void)setFrame:(NSRect)frameRect animate:(BOOL)animate;
- (void)updateState;
// Called when the button is removed from the toolbar and will soon be deleted.
- (void)onRemoved;
- (BOOL)isAnimating;
// Stops any currently running animation. The button's frame is unchanged.
- (void)stopAnimation;
// Returns the frame the button will occupy once animation is complete, or its
// current frame if it is not animating.
- (NSRect)frameAfterAnimation;
- (ToolbarActionViewController*)viewController;
// Returns a pointer to an autoreleased NSImage with the badge, shadow and
// cell image drawn into it.
- (NSImage*)compositedImage;
// Shows the context menu for the action.
- (void)showContextMenu;
@property(readonly, nonatomic) BOOL isBeingDragged;
@end
@interface BrowserActionButton(TestingAPI)
// Sets a context menu to use for testing purposes.
- (void)setTestContextMenu:(NSMenu*)testContextMenu;
// Returns true if the action wants to run.
- (BOOL)wantsToRunForTesting;
// Returns true if the cell is highlighted.
- (BOOL)isHighlighted;
@end
@interface BrowserActionCell : ImageButtonCell {
@private
// The controller for the browser actions bar that owns the button. Weak.
BrowserActionsController* browserActionsController_;
}
@property(assign, nonatomic)
BrowserActionsController* browserActionsController;
@end
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTION_BUTTON_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_H_
#import <Cocoa/Cocoa.h>
#include <memory>
#include "base/mac/scoped_nsobject.h"
namespace ui {
struct NinePartImageIds;
}
// Sent when a user-initiated drag to resize the container is initiated.
extern NSString* const kBrowserActionGrippyDragStartedNotification;
// Sent when a user-initiated drag is resizing the container.
extern NSString* const kBrowserActionGrippyDraggingNotification;
// Sent when a user-initiated drag to resize the container has finished.
extern NSString* const kBrowserActionGrippyDragFinishedNotification;
// Sent when the Browser Actions container view is about to animate.
extern NSString* const kBrowserActionsContainerWillAnimate;
// Sent when a running animation has ended.
extern NSString* const kBrowserActionsContainerAnimationEnded;
// Key which is used to notify the translation with delta.
extern NSString* const kTranslationWithDelta;
// Sent when the container receives a key event that should be processed.
// The userInfo contains a single entry with the key event.
extern NSString* const kBrowserActionsContainerReceivedKeyEvent;
// The key into the userInfo dictionary to retrieve the key event (stored as an
// integer).
extern NSString* const kBrowserActionsContainerKeyEventKey;
// The possible key actions to process.
enum BrowserActionsContainerKeyAction {
BROWSER_ACTIONS_INCREMENT_FOCUS = 0,
BROWSER_ACTIONS_DECREMENT_FOCUS = 1,
BROWSER_ACTIONS_EXECUTE_CURRENT = 2,
BROWSER_ACTIONS_INVALID_KEY_ACTION = 3,
};
// The view that encompasses the Browser Action buttons in the toolbar and
// provides mechanisms for resizing.
@interface BrowserActionsContainerView : NSView<NSAnimationDelegate> {
@private
// The frame encompasing the grippy used for resizing the container.
NSRect grippyRect_;
// Remember where in the grippy the drag began.
CGFloat dragOffset_;
// Whether the container is currently being resized by the user.
BOOL userIsResizing_;
// Whether the user can resize the container; this is disabled for overflow
// (where it would make no sense) and during highlighting, since this is a
// temporary and entirely browser-driven sequence in order to warn the user
// about potentially dangerous items.
BOOL resizable_;
// Whether or not the container is the overflow container, and is shown in the
// app menu.
BOOL isOverflow_;
// When the left grippy is pinned, resizing the window has no effect on its
// position. This prevents it from overlapping with other elements as well
// as letting the container expand when the window is going from super small
// to large.
BOOL grippyPinned_;
// The nine-grid of the highlight to paint, if any.
std::unique_ptr<ui::NinePartImageIds> highlight_;
base::scoped_nsobject<NSViewAnimation> resizeAnimation_;
}
// Sets whether or not the container is the overflow container.
- (void)setIsOverflow:(BOOL)isOverflow;
// Sets whether or not the container is highlighting.
- (void)setHighlight:(std::unique_ptr<ui::NinePartImageIds>)highlight;
// Reeturns true if the container is currently highlighting.
- (BOOL)isHighlighting;
// Resizes the container to the given ideal width, optionally animating.
- (void)resizeToWidth:(CGFloat)width animate:(BOOL)animate;
// Returns the frame of the container after the running animation has finished.
// If no animation is running, returns the container's current frame.
- (NSRect)animationEndFrame;
// Returns true if the view is animating.
- (BOOL)isAnimating;
// Stops any animation in progress.
- (void)stopAnimation;
// Returns true if this view is currently resizable.
- (BOOL)canBeResized;
@property(nonatomic) CGFloat minWidth;
@property(nonatomic) CGFloat maxWidth;
@property(nonatomic) BOOL grippyPinned;
@property(readonly, nonatomic) BOOL userIsResizing;
@end
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTAINER_VIEW_H_
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_container_view.h"
#import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
namespace {
const CGFloat kContainerHeight = 15.0;
const CGFloat kMinimumContainerWidth = 3.0;
const CGFloat kMaxAllowedWidthForTest = 50.0;
class BrowserActionsContainerViewTest : public CocoaTest {
public:
void SetUp() override {
CocoaTest::SetUp();
view_.reset([[BrowserActionsContainerView alloc]
initWithFrame:NSMakeRect(0, 0, 0, kContainerHeight)]);
}
base::scoped_nsobject<BrowserActionsContainerView> view_;
};
TEST_F(BrowserActionsContainerViewTest, BasicTests) {
EXPECT_TRUE([view_ isHidden]);
}
TEST_F(BrowserActionsContainerViewTest, SetWidthTests) {
[view_ setMinWidth:kMinimumContainerWidth];
[view_ setMaxWidth:kMaxAllowedWidthForTest];
// Try setting below the minimum width.
[view_ resizeToWidth:kMinimumContainerWidth - 1 animate:NO];
EXPECT_EQ(kMinimumContainerWidth, NSWidth([view_ frame])) << "Frame width is "
<< "less than the minimum allowed.";
[view_ resizeToWidth:35.0 animate:NO];
EXPECT_EQ(35.0, NSWidth([view_ frame]));
[view_ resizeToWidth:20.0 animate:NO];
EXPECT_EQ(20.0, NSWidth([view_ frame]));
// Resize the view with animation. It shouldn't immediately take the new
// value, but the animationEndFrame should reflect the pending change.
[view_ resizeToWidth:40.0 animate:YES];
EXPECT_LE(NSWidth([view_ frame]), 40.0);
EXPECT_EQ(40.0, NSWidth([view_ animationEndFrame]));
// The container should be able to be resized while animating (simply taking
// the newest target width).
[view_ resizeToWidth:30.0 animate:YES];
EXPECT_EQ(30.0, NSWidth([view_ animationEndFrame]));
// Test with no animation again. The animationEndFrame should also reflect
// the current frame, if no animation is pending.
[view_ resizeToWidth:35.0 animate:NO];
EXPECT_EQ(35.0, NSWidth([view_ frame]));
EXPECT_EQ(35.0, NSWidth([view_ animationEndFrame]));
[view_ resizeToWidth:kMaxAllowedWidthForTest + 10.0 animate:NO];
EXPECT_EQ(kMaxAllowedWidthForTest, NSWidth([view_ frame]));
}
} // namespace
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
#import <Cocoa/Cocoa.h>
#include <memory>
#import "base/mac/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/has_weak_browser_pointer.h"
#include "ui/gfx/geometry/size.h"
class Browser;
@class BrowserActionButton;
@class BrowserActionsContainerView;
@class MenuButton;
class ToolbarActionsBar;
class ToolbarActionsBarBubbleViewsPresenter;
class ToolbarActionsBarDelegate;
namespace content {
class WebContents;
}
// Sent when the visibility of the Browser Actions changes.
extern NSString* const kBrowserActionVisibilityChangedNotification;
// Handles state and provides an interface for controlling the Browser Actions
// container within the Toolbar.
@interface BrowserActionsController
: NSObject<NSMenuDelegate, HasWeakBrowserPointer> {
@private
// Reference to the current browser. Weak.
Browser* browser_;
// The view from Toolbar.xib we'll be rendering our browser actions in. Weak.
BrowserActionsContainerView* containerView_;
// Array of toolbar action buttons in the correct order for them to be
// displayed (includes both hidden and visible buttons).
base::scoped_nsobject<NSMutableArray> buttons_;
// The delegate for the ToolbarActionsBar.
std::unique_ptr<ToolbarActionsBarDelegate> toolbarActionsBarBridge_;
// The controlling ToolbarActionsBar.
std::unique_ptr<ToolbarActionsBar> toolbarActionsBar_;
// True if this is the overflow container for toolbar actions.
BOOL isOverflow_;
// The index of the currently-focused view in the overflow menu, or -1 if
// no view is focused.
NSInteger focusedViewIndex_;
// Bridge for showing the toolkit-views bubble on a Cocoa browser.
std::unique_ptr<ToolbarActionsBarBubbleViewsPresenter> viewsBubblePresenter_;
// True if a toolbar action button is being dragged.
BOOL isDraggingSession_;
}
@property(nonatomic) CGFloat maxWidth;
@property(readonly, nonatomic) BrowserActionsContainerView* containerView;
@property(readonly, nonatomic) Browser* browser;
@property(readonly, nonatomic) BOOL isOverflow;
// Initializes the controller given the current browser and container view that
// will hold the browser action buttons. If |mainController| is nil, the created
// BrowserActionsController will be the main controller; otherwise (if this is
// for the overflow menu), |mainController| should be controller of the main bar
// for the |browser|.
- (id)initWithBrowser:(Browser*)browser
containerView:(BrowserActionsContainerView*)container
mainController:(BrowserActionsController*)mainController;
// Update the display of all buttons.
- (void)update;
// Returns the current number of browser action buttons within the container,
// whether or not they are displayed.
- (NSUInteger)buttonCount;
// Returns the current number of browser action buttons displayed in the
// container.
- (NSUInteger)visibleButtonCount;
// Returns the preferred size for the container.
- (gfx::Size)preferredSize;
// Returns where the popup arrow should point to for the action with the given
// |id|. If passed an id with no corresponding button, returns NSZeroPoint.
- (NSPoint)popupPointForId:(const std::string&)id;
// Returns the currently-active web contents.
- (content::WebContents*)currentWebContents;
// Returns the BrowserActionButton in the main browser actions container (as
// opposed to the overflow) for the action of the given id.
- (BrowserActionButton*)mainButtonForId:(const std::string&)id;
// Returns the associated ToolbarActionsBar.
- (ToolbarActionsBar*)toolbarActionsBar;
// Sets whether or not the overflow container is focused in the app menu.
- (void)setFocusedInOverflow:(BOOL)focused;
// Returns the size for the provided |maxWidth| of the overflow menu.
- (gfx::Size)sizeForOverflowWidth:(int)maxWidth;
// Called when the window for the active bubble is closing, and sets the active
// bubble to nil.
- (void)bubbleWindowClosing;
@end // @interface BrowserActionsController
@interface BrowserActionsController(TestingAPI)
- (BrowserActionButton*)buttonWithIndex:(NSUInteger)index;
@end
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_BROWSER_ACTIONS_CONTROLLER_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_
#import <Foundation/Foundation.h>
#include "base/macros.h"
#include "chrome/browser/ui/extensions/extension_action_platform_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
// The Cocoa-specific implementation for ExtensionActionPlatformDelegate.
class ExtensionActionPlatformDelegateCocoa
: public ExtensionActionPlatformDelegate,
public content::NotificationObserver {
public:
ExtensionActionPlatformDelegateCocoa(
ExtensionActionViewController* controller);
~ExtensionActionPlatformDelegateCocoa() override;
private:
// ExtensionActionPlatformDelegate:
void RegisterCommand() override;
void OnDelegateSet() override;
void ShowPopup(
std::unique_ptr<extensions::ExtensionViewHost> host,
bool grant_tab_permissions,
ExtensionActionViewController::PopupShowAction show_action) override;
void ShowContextMenu() override;
// content::NotificationObserver:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// Returns the point at which the popup should be shown in window coordinates.
NSPoint GetPopupPoint() const;
// The main controller for this extension action.
ExtensionActionViewController* controller_;
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(ExtensionActionPlatformDelegateCocoa);
};
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_COCOA_H_
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "chrome/browser/ui/cocoa/extensions/extension_action_platform_delegate_cocoa.h"
#include <string>
#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_view_host.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/cocoa/browser_dialogs_views_mac.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.h"
#import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "extensions/browser/notification_types.h"
#include "extensions/common/extension.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/ui_features.h"
#include "ui/gfx/geometry/point.h"
#import "ui/gfx/mac/coordinate_conversion.h"
#include "ui/gfx/native_widget_types.h"
namespace {
// Returns the notification to listen to for activation for a particular
// |extension_action|.
int GetNotificationTypeForAction(const ExtensionAction& extension_action) {
if (extension_action.action_type() == extensions::ActionInfo::TYPE_BROWSER)
return extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC;
// We should only have page and browser action types.
DCHECK_EQ(extensions::ActionInfo::TYPE_PAGE, extension_action.action_type());
return extensions::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC;
}
} // namespace
// static
std::unique_ptr<ExtensionActionPlatformDelegate>
ExtensionActionPlatformDelegate::CreateCocoa(
ExtensionActionViewController* controller) {
return base::WrapUnique(new ExtensionActionPlatformDelegateCocoa(controller));
}
#if !BUILDFLAG(MAC_VIEWS_BROWSER)
std::unique_ptr<ExtensionActionPlatformDelegate>
ExtensionActionPlatformDelegate::Create(
ExtensionActionViewController* controller) {
return CreateCocoa(controller);
}
#endif
ExtensionActionPlatformDelegateCocoa::ExtensionActionPlatformDelegateCocoa(
ExtensionActionViewController* controller)
: controller_(controller) {
}
ExtensionActionPlatformDelegateCocoa::~ExtensionActionPlatformDelegateCocoa() {
}
void ExtensionActionPlatformDelegateCocoa::RegisterCommand() {
// Commands are handled elsewhere for Cocoa.
}
void ExtensionActionPlatformDelegateCocoa::OnDelegateSet() {
registrar_.Add(
this,
GetNotificationTypeForAction(*controller_->extension_action()),
content::Source<Profile>(controller_->browser()->profile()));
}
void ExtensionActionPlatformDelegateCocoa::ShowPopup(
std::unique_ptr<extensions::ExtensionViewHost> host,
bool grant_tab_permissions,
ExtensionActionViewController::PopupShowAction show_action) {
ExtensionPopup::ShowAction popupShowAction =
show_action == ExtensionActionViewController::SHOW_POPUP
? ExtensionPopup::SHOW
: ExtensionPopup::SHOW_AND_INSPECT;
gfx::NativeWindow containingWindow =
controller_->browser()->window()->GetNativeWindow();
NSPoint pointWindow = GetPopupPoint();
NSPoint pointScreen =
ui::ConvertPointFromWindowToScreen(containingWindow, pointWindow);
gfx::Point viewsScreenPoint = gfx::ScreenPointFromNSPoint(pointScreen);
ExtensionPopupViewsMac::ShowPopup(std::move(host), containingWindow,
viewsScreenPoint, popupShowAction);
}
void ExtensionActionPlatformDelegateCocoa::ShowContextMenu() {
// We should only use this code path for extensions shown in the toolbar.
BrowserWindowController* windowController = [BrowserWindowController
browserWindowControllerForWindow:controller_->browser()
->window()
->GetNativeWindow()];
BrowserActionsController* actionsController =
[[windowController toolbarController] browserActionsController];
[[actionsController mainButtonForId:controller_->GetId()] showContextMenu];
}
NSPoint ExtensionActionPlatformDelegateCocoa::GetPopupPoint() const {
BrowserWindowController* windowController =
[BrowserWindowController browserWindowControllerForWindow:
controller_->browser()->window()->GetNativeWindow()];
BrowserActionsController* actionsController =
[[windowController toolbarController] browserActionsController];
return [actionsController popupPointForId:controller_->GetId()];
}
void ExtensionActionPlatformDelegateCocoa::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
case extensions::NOTIFICATION_EXTENSION_COMMAND_BROWSER_ACTION_MAC:
case extensions::NOTIFICATION_EXTENSION_COMMAND_PAGE_ACTION_MAC: {
DCHECK_EQ(type,
GetNotificationTypeForAction(*controller_->extension_action()));
std::pair<const std::string, gfx::NativeWindow>* payload =
content::Details<std::pair<const std::string, gfx::NativeWindow> >(
details).ptr();
const std::string& extension_id = payload->first;
gfx::NativeWindow window = payload->second;
if (window == controller_->browser()->window()->GetNativeWindow() &&
extension_id == controller_->extension()->id() &&
controller_->IsEnabled(
controller_->view_delegate()->GetCurrentWebContents())) {
controller_->ExecuteAction(true);
}
break;
}
default:
NOTREACHED() << "Unexpected notification";
}
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Cocoa/Cocoa.h>
#include "build/buildflag.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/extensions/browser_action_button.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_views_presenter.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
#include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
#include "ui/base/ui_features.h"
#import "ui/gfx/mac/coordinate_conversion.h"
namespace {
// Returns the ToolbarController for the given browser.
ToolbarController* ToolbarControllerForBrowser(Browser* browser) {
return [[BrowserWindowController
browserWindowControllerForWindow:browser->window()->GetNativeWindow()]
toolbarController];
}
} // namespace
@interface BrowserActionsController (ViewsTestingAPI)
- (ToolbarActionsBarBubbleViewsPresenter*)presenter;
@end
@implementation BrowserActionsController (ViewsTestingAPI)
- (ToolbarActionsBarBubbleViewsPresenter*)presenter {
return viewsBubblePresenter_.get();
}
@end
namespace test {
class ToolbarActionsBarBubbleViewsPresenterTestApi {
public:
static ToolbarActionsBarBubbleViews* GetBubble(
ToolbarActionsBarBubbleViewsPresenter* presenter) {
return presenter->active_bubble_;
}
};
} // namespace test
// static
ToolbarActionsBarBubbleViews*
ExtensionMessageBubbleBrowserTest::GetViewsBubbleForCocoaBrowser(
Browser* browser) {
ToolbarController* toolbarController = ToolbarControllerForBrowser(browser);
BrowserActionsController* actionsController =
[toolbarController browserActionsController];
return test::ToolbarActionsBarBubbleViewsPresenterTestApi::GetBubble(
[actionsController presenter]);
}
#if !BUILDFLAG(MAC_VIEWS_BROWSER)
// static
ToolbarActionsBarBubbleViews*
ExtensionMessageBubbleBrowserTest::GetViewsBubbleForBrowser(Browser* browser) {
return GetViewsBubbleForCocoaBrowser(browser);
}
#endif
// static
gfx::Rect
ExtensionMessageBubbleBrowserTest::GetAnchorReferenceBoundsForCocoaBrowser(
Browser* browser,
AnchorPosition anchor) {
ToolbarController* toolbarController = ToolbarControllerForBrowser(browser);
BrowserActionsController* actionsController =
[toolbarController browserActionsController];
NSView* anchor_view = nil;
switch (anchor) {
case ExtensionMessageBubbleBrowserTest::ANCHOR_BROWSER_ACTION:
anchor_view = [actionsController buttonWithIndex:0];
break;
case ExtensionMessageBubbleBrowserTest::ANCHOR_APP_MENU:
anchor_view = [toolbarController appMenuButton];
break;
}
EXPECT_TRUE(anchor_view);
NSWindow* parent_window = [anchor_view window];
ToolbarActionsBarBubbleViews* bubble = GetViewsBubbleForBrowser(browser);
EXPECT_TRUE(bubble);
EXPECT_EQ([parent_window contentView], bubble->parent_window());
NSRect anchor_bounds_in_window =
[anchor_view convertRect:[anchor_view bounds] toView:nil];
NSRect reference_bounds_in_screen =
[parent_window convertRectToScreen:anchor_bounds_in_window];
return gfx::ScreenRectFromNSRect(reference_bounds_in_screen);
}
#if !BUILDFLAG(MAC_VIEWS_BROWSER)
// static
gfx::Rect ExtensionMessageBubbleBrowserTest::GetAnchorReferenceBoundsForBrowser(
Browser* browser,
AnchorPosition anchor) {
return GetAnchorReferenceBoundsForCocoaBrowser(browser, anchor);
}
#endif
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_VIEWS_MAC_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_VIEWS_MAC_H_
#import <Foundation/Foundation.h>
#include <memory>
#import "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "chrome/browser/ui/views/extensions/extension_popup.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/bubble/bubble_border.h"
// Bridges NSWindow and the Anchor View expected by ExtensionPopup.
class ExtensionPopupViewsMac : public ExtensionPopup {
public:
~ExtensionPopupViewsMac() override;
// Create and show a popup with the given |host| anchored at |anchor_point| in
// screen coordinates. The |parent_window| serves as the parent to the popup
// and is used to handle dismissing the popup on activation and lifetime
// events. |show_action| controls the dismissal of the popup with respect to
// dev tools. The actual display of the popup is delayed until the page
// contents finish loading in order to minimize UI flashing and resizing.
static ExtensionPopupViewsMac* ShowPopup(
std::unique_ptr<extensions::ExtensionViewHost> host,
gfx::NativeWindow parent_window,
const gfx::Point& anchor_point,
ExtensionPopup::ShowAction show_action);
private:
ExtensionPopupViewsMac(std::unique_ptr<extensions::ExtensionViewHost> host,
const gfx::Point& anchor_point,
ExtensionPopup::ShowAction show_action);
base::scoped_nsobject<NSMutableArray> observer_tokens_;
DISALLOW_COPY_AND_ASSIGN(ExtensionPopupViewsMac);
};
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_POPUP_VIEWS_MAC_H_
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/cocoa/extensions/extension_popup_views_mac.h"
#import <AppKit/AppKit.h>
#include "chrome/browser/extensions/extension_view_host.h"
#import "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
#include "ui/gfx/geometry/point.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
ExtensionPopupViewsMac::~ExtensionPopupViewsMac() {
// ObjC id collides with views::View::id().
for (::id token in observer_tokens_.get())
[[NSNotificationCenter defaultCenter] removeObserver:token];
}
// static
ExtensionPopupViewsMac* ExtensionPopupViewsMac::ShowPopup(
std::unique_ptr<extensions::ExtensionViewHost> host,
gfx::NativeWindow parent_window,
const gfx::Point& anchor_point,
ExtensionPopup::ShowAction show_action) {
// We can't use std::make_unique here as the constructor is private.
std::unique_ptr<ExtensionPopupViewsMac> popup_owned(
new ExtensionPopupViewsMac(std::move(host), anchor_point, show_action));
auto* popup = popup_owned.get();
popup->set_parent_window([parent_window contentView]);
views::BubbleDialogDelegateView::CreateBubble(popup_owned.release());
KeepBubbleAnchored(popup);
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
// ObjC id collides with views::View::id().
::id token = [center addObserverForName:NSWindowDidBecomeKeyNotification
object:parent_window
queue:nil
usingBlock:^(NSNotification* notification) {
popup->CloseUnlessUnderInspection();
}];
[popup->observer_tokens_ addObject:token];
return popup;
}
ExtensionPopupViewsMac::ExtensionPopupViewsMac(
std::unique_ptr<extensions::ExtensionViewHost> host,
const gfx::Point& anchor_point,
ExtensionPopup::ShowAction show_action)
: ExtensionPopup(host.release(),
nullptr,
views::BubbleBorder::TOP_RIGHT /* views flips for RTL. */,
show_action),
observer_tokens_([[NSMutableArray alloc] init]) {
SetAnchorRect(gfx::Rect(anchor_point, gfx::Size()));
}
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_PRESENTER_H_
#define CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_PRESENTER_H_
#import <Foundation/Foundation.h>
#include <memory>
#include "base/macros.h"
#include "ui/views/widget/widget_observer.h"
@class NSWindow;
namespace test {
class ToolbarActionsBarBubbleViewsPresenterTestApi;
}
@class BrowserActionsController;
class ToolbarActionsBarBubbleDelegate;
class ToolbarActionsBarBubbleViews;
// Helper class for showing a toolkit-views toolbar action bubble on a Cocoa
// browser.
class ToolbarActionsBarBubbleViewsPresenter : public views::WidgetObserver {
public:
explicit ToolbarActionsBarBubbleViewsPresenter(
BrowserActionsController* owner);
~ToolbarActionsBarBubbleViewsPresenter() override;
// Presents |bubble| attached to the provided browser |parent_window| at
// |point_in_screen|. |anchored_to_action_view| indicates that the anchor is
// a specific browser action view, rather than something more general.
void PresentAt(std::unique_ptr<ToolbarActionsBarBubbleDelegate> bubble,
NSWindow* parent_window,
NSPoint point_in_screen,
bool anchored_to_action_view);
private:
friend class test::ToolbarActionsBarBubbleViewsPresenterTestApi;
// WidgetObserver:
void OnWidgetClosing(views::Widget* widget) override;
void OnWidgetDestroying(views::Widget* widget) override;
BrowserActionsController* owner_; // Weak. Owns |this|.
// Weak. Owns by its Widget (observed by |this|).
ToolbarActionsBarBubbleViews* active_bubble_;
DISALLOW_COPY_AND_ASSIGN(ToolbarActionsBarBubbleViewsPresenter);
};
#endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_TOOLBAR_ACTIONS_BAR_BUBBLE_VIEWS_PRESENTER_H_
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "chrome/browser/ui/cocoa/extensions/toolbar_actions_bar_bubble_views_presenter.h"
#import <Cocoa/Cocoa.h>
#include "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
#import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_bar_bubble_delegate.h"
#include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
#import "ui/gfx/mac/coordinate_conversion.h"
#include "ui/views/widget/widget.h"
ToolbarActionsBarBubbleViewsPresenter::ToolbarActionsBarBubbleViewsPresenter(
BrowserActionsController* owner)
: owner_(owner), active_bubble_(nullptr) {}
ToolbarActionsBarBubbleViewsPresenter::
~ToolbarActionsBarBubbleViewsPresenter() {
// Child windows should never outlive the controller that owns |this|.
DCHECK(!active_bubble_)
<< "|active_bubble_| should be cleared by OnWidgetDestroying().";
}
void ToolbarActionsBarBubbleViewsPresenter::PresentAt(
std::unique_ptr<ToolbarActionsBarBubbleDelegate> delegate,
NSWindow* parent_window,
NSPoint point_in_screen,
bool anchored_to_action_view) {
gfx::Point views_point = gfx::ScreenPointFromNSPoint(point_in_screen);
// For a Cocoa browser, the presenter must pass nullptr for |anchor_view|.
ToolbarActionsBarBubbleViews* bubble = new ToolbarActionsBarBubbleViews(
nullptr, views_point, anchored_to_action_view, std::move(delegate));
bubble->set_parent_window([parent_window contentView]);
active_bubble_ = bubble;
views::BubbleDialogDelegateView::CreateBubble(bubble);
bubble->GetWidget()->AddObserver(this);
bubble->Show();
KeepBubbleAnchored(bubble);
}
void ToolbarActionsBarBubbleViewsPresenter::OnWidgetClosing(
views::Widget* widget) {
// OnWidgetClosing() gives an earlier signal than OnWidgetDestroying() but is
// not called when the bubble is closed synchronously. Note the observer is
// removed so it's impossible for both methods to be triggered.
OnWidgetDestroying(widget);
}
void ToolbarActionsBarBubbleViewsPresenter::OnWidgetDestroying(
views::Widget* widget) {
active_bubble_ = nullptr;
[owner_ bubbleWindowClosing];
widget->RemoveObserver(this);
}
......@@ -20,8 +20,6 @@
@class AutocompleteTextFieldEditor;
@class BackForwardMenuController;
class Browser;
@class BrowserActionsContainerView;
@class BrowserActionsController;
class CommandUpdater;
class LocationBarViewMac;
@class MenuButton;
......@@ -56,7 +54,7 @@ class NotificationBridge;
IBOutlet ToolbarButtonCocoa* homeButton_;
IBOutlet MenuButton* appMenuButton_;
IBOutlet AutocompleteTextField* locationBar_;
IBOutlet BrowserActionsContainerView* browserActionsContainerView_;
IBOutlet id browserActionsContainerView_;
@private
CommandUpdater* commands_; // weak, one per window
......@@ -69,7 +67,6 @@ class NotificationBridge;
autocompleteTextFieldEditor_;
base::scoped_nsobject<BackForwardMenuController> backMenuController_;
base::scoped_nsobject<BackForwardMenuController> forwardMenuController_;
base::scoped_nsobject<BrowserActionsController> browserActionsController_;
// Used for monitoring the optional toolbar button prefs.
std::unique_ptr<ToolbarControllerInternal::NotificationBridge>
......@@ -170,15 +167,9 @@ class NotificationBridge;
// |ToolbarViewCocoa| (0 means don't show it); no-op otherwise.
- (void)setDividerOpacity:(CGFloat)opacity;
// Create and add the Browser Action buttons to the toolbar view.
- (void)createBrowserActionButtons;
// Updates the visibility of the toolbar, with an optional animation.
- (void)updateVisibility:(BOOL)visible withAnimation:(BOOL)animate;
// Return the BrowserActionsController for this toolbar.
- (BrowserActionsController*)browserActionsController;
// Returns the app menu button.
- (NSButton*)appMenuButton;
......
......@@ -5,7 +5,6 @@
#ifndef CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_
#define CHROME_BROWSER_UI_EXTENSIONS_EXTENSION_ACTION_PLATFORM_DELEGATE_H_
#include "build/build_config.h"
#include "chrome/browser/ui/extensions/extension_action_view_controller.h"
namespace extensions {
......@@ -20,12 +19,6 @@ class ExtensionActionPlatformDelegate {
// platform-specific implementation for the class.
static std::unique_ptr<ExtensionActionPlatformDelegate> Create(
ExtensionActionViewController* controller);
#if defined(OS_MACOSX)
// Temporary shim for Polychrome. See bottom of first comment in
// https://crbug.com/80495 for details.
static std::unique_ptr<ExtensionActionPlatformDelegate> CreateCocoa(
ExtensionActionViewController* controller);
#endif
// The following are forwarded from ToolbarActionViewController. See that
// class for the definitions.
......
......@@ -8,7 +8,6 @@
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_view_host.h"
#include "chrome/browser/profiles/profile.h"
......@@ -18,7 +17,6 @@
#include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
#include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate_views.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views_mode_controller.h"
#include "chrome/common/extensions/api/extension_action/action_info.h"
#include "chrome/common/extensions/command.h"
#include "content/public/browser/notification_details.h"
......@@ -34,10 +32,6 @@ using extensions::ActionInfo;
std::unique_ptr<ExtensionActionPlatformDelegate>
ExtensionActionPlatformDelegate::Create(
ExtensionActionViewController* controller) {
#if defined(OS_MACOSX)
if (views_mode_controller::IsViewsBrowserCocoa())
return CreateCocoa(controller);
#endif
return base::WrapUnique(new ExtensionActionPlatformDelegateViews(controller));
}
......
......@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "build/buildflag.h"
#include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
#include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views_mode_controller.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
......@@ -25,10 +23,6 @@ ToolbarView* GetToolbarViewForBrowser(Browser* browser) {
// static
ToolbarActionsBarBubbleViews*
ExtensionMessageBubbleBrowserTest::GetViewsBubbleForBrowser(Browser* browser) {
#if BUILDFLAG(MAC_VIEWS_BROWSER)
if (views_mode_controller::IsViewsBrowserCocoa())
return GetViewsBubbleForCocoaBrowser(browser);
#endif
return static_cast<ToolbarActionsBarBubbleViews*>(
GetToolbarViewForBrowser(browser)->browser_actions()->active_bubble());
}
......@@ -37,10 +31,6 @@ ExtensionMessageBubbleBrowserTest::GetViewsBubbleForBrowser(Browser* browser) {
gfx::Rect ExtensionMessageBubbleBrowserTest::GetAnchorReferenceBoundsForBrowser(
Browser* browser,
AnchorPosition anchor) {
#if BUILDFLAG(MAC_VIEWS_BROWSER)
if (views_mode_controller::IsViewsBrowserCocoa())
return GetAnchorReferenceBoundsForCocoaBrowser(browser, anchor);
#endif
ToolbarView* toolbar_view = GetToolbarViewForBrowser(browser);
BrowserActionsContainer* container = toolbar_view->browser_actions();
views::View* anchor_view = nullptr;
......
......@@ -9,7 +9,6 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/extensions/extension_action_view_controller.h"
......@@ -218,11 +217,9 @@ BrowserActionTestUtilViews::BrowserActionTestUtilViews(
browser_,
GetContainer(browser_, main_bar->test_helper_.get()))) {}
#if !defined(OS_MACOSX)
// static
std::unique_ptr<BrowserActionTestUtil> BrowserActionTestUtil::Create(
Browser* browser,
bool is_real_window) {
return std::make_unique<BrowserActionTestUtilViews>(browser, is_real_window);
}
#endif
......@@ -1935,7 +1935,6 @@ test("browser_tests") {
"../browser/ui/cocoa/applescript/window_applescript_test.mm",
"../browser/ui/cocoa/browser_window_mac_browsertest.mm",
"../browser/ui/cocoa/certificate_viewer_mac_browsertest.mm",
"../browser/ui/cocoa/extensions/extension_message_bubble_views_browsertest_mac.mm",
"../browser/ui/cocoa/share_menu_controller_browsertest.mm",
]
sources -= [
......@@ -4137,7 +4136,6 @@ test("unit_tests") {
"../browser/ui/cocoa/constrained_window/constrained_window_custom_window_unittest.mm",
"../browser/ui/cocoa/constrained_window/constrained_window_sheet_controller_unittest.mm",
"../browser/ui/cocoa/draggable_button_unittest.mm",
"../browser/ui/cocoa/extensions/browser_actions_container_view_unittest.mm",
"../browser/ui/cocoa/find_pasteboard_unittest.mm",
"../browser/ui/cocoa/first_run_dialog_controller_unittest.mm",
"../browser/ui/cocoa/floating_bar_backing_view_unittest.mm",
......@@ -4192,7 +4190,6 @@ test("unit_tests") {
"../browser/ui/cocoa/toolbar/app_toolbar_button_unittest.mm",
"../browser/ui/cocoa/toolbar/reload_button_unittest_cocoa.mm",
"../browser/ui/cocoa/toolbar/toolbar_button_unittest.mm",
"../browser/ui/cocoa/toolbar/toolbar_controller_unittest.mm",
"../browser/ui/cocoa/toolbar/toolbar_view_unittest.mm",
"../browser/ui/cocoa/touchbar/browser_window_default_touch_bar_unittest.mm",
"../browser/ui/cocoa/touchbar/credit_card_autofill_touch_bar_controller_unittest.mm",
......
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