Commit 50439b88 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

mac: Remove unused TabDialogsMac/TabDialogsCocoa.

Bug: 832676
Change-Id: I0fb8d4b1f0197dab0b988a52741724f63a18ee9f
Reviewed-on: https://chromium-review.googlesource.com/1236178
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592819}
parent fbe67a95
...@@ -9,7 +9,6 @@ assert(is_mac) ...@@ -9,7 +9,6 @@ assert(is_mac)
translated_xibs = [ translated_xibs = [
"AppMenu.xib", "AppMenu.xib",
"HungRendererDialog.xib",
"OneClickSigninDialog.xib", "OneClickSigninDialog.xib",
"SaveAccessoryView.xib", "SaveAccessoryView.xib",
"TaskManager.xib", "TaskManager.xib",
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F1077" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1090" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HungRendererController">
<connections>
<outlet property="imageView_" destination="33" id="35"/>
<outlet property="killButton_" destination="12" id="16"/>
<outlet property="messageView_" destination="31" id="41"/>
<outlet property="tableView_" destination="6" id="18"/>
<outlet property="waitButton_" destination="14" id="17"/>
<outlet property="window" destination="1" id="19"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" visibleAtLaunch="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="293" width="500" height="217"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1028"/>
<view key="contentView" id="2">
<rect key="frame" x="0.0" y="0.0" width="500" height="217"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="3">
<rect key="frame" x="128" y="60" width="352" height="112"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="xeb-Qv-dvf">
<rect key="frame" x="1" y="1" width="350" height="110"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" id="6">
<rect key="frame" x="0.0" y="0.0" width="350" height="110"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="title" width="347" minWidth="40" maxWidth="1000" id="8">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.33333299" alpha="1" colorSpace="calibratedWhite"/>
</tableHeaderCell>
<buttonCell key="dataCell" type="check" title="Check" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="42">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="20"/>
<outlet property="delegate" destination="-2" id="21"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="5">
<rect key="frame" x="1" y="150" width="423" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="4">
<rect key="frame" x="424" y="0.0" width="15" height="150"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<textField verticalHuggingPriority="750" id="31">
<rect key="frame" x="125" y="180" width="358" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" state="on" id="32">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView id="33">
<rect key="frame" x="20" y="97" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="34"/>
</imageView>
<customView id="36" customClass="GTMWidthBasedTweaker">
<rect key="frame" x="280" y="0.0" width="220" height="52"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<subviews>
<button verticalHuggingPriority="750" id="12">
<rect key="frame" x="14" y="12" width="96" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="13">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="kill:" target="-2" id="25"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="14" customClass="MultiKeyEquivalentButton">
<rect key="frame" x="110" y="12" width="96" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="push" title="^IDS_BROWSER_HANGMONITOR_RENDERER_WAIT" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="15">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
<string key="keyEquivalent" base64-UTF8="YES">
DQ
</string>
</buttonCell>
<connections>
<action selector="wait:" target="-2" id="26"/>
</connections>
</button>
</subviews>
</customView>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="24"/>
</connections>
</window>
<customObject id="37" customClass="ChromeUILocalizer"/>
<customObject id="38" customClass="GTMUILocalizerAndLayoutTweaker">
<connections>
<outlet property="localizer_" destination="37" id="39"/>
<outlet property="uiObject_" destination="1" id="40"/>
</connections>
</customObject>
</objects>
</document>
...@@ -388,10 +388,6 @@ jumbo_split_static_library("ui") { ...@@ -388,10 +388,6 @@ jumbo_split_static_library("ui") {
"cocoa/tab_contents/sad_tab_view_cocoa.mm", "cocoa/tab_contents/sad_tab_view_cocoa.mm",
"cocoa/tab_contents/tab_contents_controller.h", "cocoa/tab_contents/tab_contents_controller.h",
"cocoa/tab_contents/tab_contents_controller.mm", "cocoa/tab_contents/tab_contents_controller.mm",
"cocoa/tab_dialogs_cocoa.h",
"cocoa/tab_dialogs_cocoa.mm",
"cocoa/tab_dialogs_views_mac.h",
"cocoa/tab_dialogs_views_mac.mm",
"cocoa/tab_modal_confirm_dialog_mac.h", "cocoa/tab_modal_confirm_dialog_mac.h",
"cocoa/tab_modal_confirm_dialog_mac.mm", "cocoa/tab_modal_confirm_dialog_mac.mm",
"cocoa/tabbed_browser_window.h", "cocoa/tabbed_browser_window.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_TAB_DIALOGS_COCOA_H_
#define CHROME_BROWSER_UI_COCOA_TAB_DIALOGS_COCOA_H_
#include "base/macros.h"
#include "chrome/browser/ui/tab_dialogs.h"
// Cocoa implementation of TabDialogs interface.
class TabDialogsCocoa : public TabDialogs {
public:
explicit TabDialogsCocoa(content::WebContents* contents);
~TabDialogsCocoa() override;
// TabDialogs:
gfx::NativeView GetDialogParentView() const override;
void ShowCollectedCookies() override;
void ShowHungRendererDialog(
content::RenderWidgetHost* render_widget_host,
base::RepeatingClosure hang_monitor_restarter) override;
void HideHungRendererDialog(
content::RenderWidgetHost* render_widget_host) override;
bool IsShowingHungRendererDialog() override;
void ShowProfileSigninConfirmation(
Browser* browser,
Profile* profile,
const std::string& username,
std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) override;
void ShowManagePasswordsBubble(bool user_action) override;
void HideManagePasswordsBubble() override;
protected:
content::WebContents* web_contents() const { return web_contents_; }
private:
content::WebContents* web_contents_; // Weak. Owns this.
DISALLOW_COPY_AND_ASSIGN(TabDialogsCocoa);
};
#endif // CHROME_BROWSER_UI_COCOA_TAB_DIALOGS_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.
#include "chrome/browser/ui/cocoa/tab_dialogs_cocoa.h"
#include <memory>
#import "chrome/browser/ui/cocoa/hung_renderer_controller.h"
#import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_dialog_cocoa.h"
#include "chrome/browser/ui/cocoa/tab_dialogs_views_mac.h"
#include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/ui_features.h"
TabDialogsCocoa::TabDialogsCocoa(content::WebContents* contents)
: web_contents_(contents) {
DCHECK(contents);
}
TabDialogsCocoa::~TabDialogsCocoa() {
}
gfx::NativeView TabDialogsCocoa::GetDialogParentView() const {
// View hierarchy of the contents view:
// NSView -- switchView, same for all tabs
// +- TabContentsContainerView -- TabContentsController's view
// +- WebContentsViewCocoa
//
// Changing it? Do not forget to modify
// -[TabStripControllerCocoa swapInTabAtIndex:] too.
return [web_contents_->GetNativeView() superview];
}
void TabDialogsCocoa::ShowCollectedCookies() {
NOTREACHED() << "MacViewsBrowser builds can't use Cocoa dialogs";
}
void TabDialogsCocoa::ShowHungRendererDialog(
content::RenderWidgetHost* render_widget_host,
base::RepeatingClosure hang_monitor_restarter) {
[HungRendererController showForWebContents:web_contents_
renderWidgetHost:render_widget_host
timeoutRestarter:hang_monitor_restarter];
}
void TabDialogsCocoa::HideHungRendererDialog(
content::RenderWidgetHost* render_widget_host) {
[HungRendererController endForWebContents:web_contents_
renderWidgetHost:render_widget_host];
}
bool TabDialogsCocoa::IsShowingHungRendererDialog() {
return [HungRendererController isShowing];
}
void TabDialogsCocoa::ShowProfileSigninConfirmation(
Browser* browser,
Profile* profile,
const std::string& username,
std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) {
ProfileSigninConfirmationDialogCocoa::Show(browser, web_contents_, profile,
username, std::move(delegate));
}
void TabDialogsCocoa::ShowManagePasswordsBubble(bool user_action) {
// The method is implemented by TabDialogsViewsMac and only that one is to be
// called due to MacViews release.
NOTREACHED();
}
void TabDialogsCocoa::HideManagePasswordsBubble() {
// The method is implemented by TabDialogsViewsMac and only that one is to be
// called due to MacViews release.
NOTREACHED();
}
// 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_TAB_DIALOGS_VIEWS_MAC_H_
#define CHROME_BROWSER_UI_COCOA_TAB_DIALOGS_VIEWS_MAC_H_
#include "chrome/browser/ui/cocoa/tab_dialogs_cocoa.h"
// Implementation of TabDialogs interface for toolkit-views dialogs on Mac.
class TabDialogsViewsMac : public TabDialogsCocoa {
public:
explicit TabDialogsViewsMac(content::WebContents* contents);
~TabDialogsViewsMac() override;
// TabDialogs:
void ShowCollectedCookies() override;
void ShowProfileSigninConfirmation(
Browser* browser,
Profile* profile,
const std::string& username,
std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) override;
void ShowManagePasswordsBubble(bool user_action) override;
void HideManagePasswordsBubble() override;
private:
DISALLOW_COPY_AND_ASSIGN(TabDialogsViewsMac);
};
#endif // CHROME_BROWSER_UI_COCOA_TAB_DIALOGS_VIEWS_MAC_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.
#include "chrome/browser/ui/cocoa/tab_dialogs_views_mac.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/bubble_anchor_helper_views.h"
#include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
#include "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h"
#include "chrome/browser/ui/views/collected_cookies_views.h"
#include "chrome/browser/ui/views/passwords/password_bubble_view_base.h"
#include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h"
#include "chrome/browser/ui/views/tab_dialogs_views.h"
#include "chrome/browser/ui/views_mode_controller.h"
#include "content/public/browser/web_contents.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#include "ui/base/ui_features.h"
#import "ui/gfx/mac/coordinate_conversion.h"
namespace {
gfx::Point ScreenPointFromBrowser(Browser* browser, NSPoint ns_point) {
return gfx::ScreenPointFromNSPoint(ui::ConvertPointFromWindowToScreen(
browser->window()->GetNativeWindow(), ns_point));
}
}
// static
void TabDialogs::CreateForWebContents(content::WebContents* contents) {
DCHECK(contents);
if (!FromWebContents(contents)) {
// This is a bit subtle: if IsViewsBrowserCocoa(), that means this is a
// mac_views_browser build using a Cocoa browser window, in which case
// TabDialogsViewsMac is the right implementation; mostly it inherits
// behavior from TabDialogsCocoa, which will only work with a Cocoa browser
// window. If !IsViewsBrowserCocoa(), there is a Views browser window, so
// TabDialogsViews (which is the only implementation that works with a Views
// browser window) is the right implementation.
//
// Note that the ternary below can't use std::make_unique<> because
// TabDialogsViewsMac and TabDialogsViews are not compatible types (neither
// is an ancestor of the other).
std::unique_ptr<TabDialogs> tab_dialogs(
views_mode_controller::IsViewsBrowserCocoa()
? static_cast<TabDialogs*>(new TabDialogsViewsMac(contents))
: static_cast<TabDialogs*>(new TabDialogsViews(contents)));
contents->SetUserData(UserDataKey(), std::move(tab_dialogs));
}
}
TabDialogsViewsMac::TabDialogsViewsMac(content::WebContents* contents)
: TabDialogsCocoa(contents) {}
TabDialogsViewsMac::~TabDialogsViewsMac() {}
void TabDialogsViewsMac::ShowCollectedCookies() {
// Deletes itself on close.
new CollectedCookiesViews(web_contents());
}
void TabDialogsViewsMac::ShowProfileSigninConfirmation(
Browser* browser,
Profile* profile,
const std::string& username,
std::unique_ptr<ui::ProfileSigninConfirmationDelegate> delegate) {
ProfileSigninConfirmationDialogViews::ShowDialog(browser, profile, username,
std::move(delegate));
}
void TabDialogsViewsMac::ShowManagePasswordsBubble(bool user_action) {
NSWindow* window = [web_contents()->GetNativeView() window];
if (!window) {
// The tab isn't active right now.
return;
}
// Don't show the bubble again if it's already showing. A second click on the
// location icon in the omnibox will dismiss an open bubble. This behaviour is
// consistent with the non-Mac views implementation.
// Note that when the browser is toolkit-views, IsBubbleShown() is checked
// earlier because the bubble is shown on mouse release (but dismissed on
// mouse pressed). A Cocoa browser does both on mouse pressed, so a check
// when showing is sufficient.
if (PasswordBubbleViewBase::manage_password_bubble() &&
PasswordBubbleViewBase::manage_password_bubble()
->GetWidget()
->IsVisible())
return;
Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
bool has_location_bar =
browser && browser->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
NSPoint ns_anchor_point;
views::BubbleBorder::Arrow arrow = views::BubbleBorder::TOP_RIGHT;
if (has_location_bar) {
BrowserWindowController* bwc =
[BrowserWindowController browserWindowControllerForWindow:window];
LocationBarViewMac* location_bar = [bwc locationBarBridge];
ns_anchor_point = location_bar->GetBubblePointForDecoration(
location_bar->manage_passwords_decoration());
} else {
// Center the bubble if there's no location bar.
NSRect content_frame = [[window contentView] frame];
ns_anchor_point = NSMakePoint(NSMidX(content_frame), NSMaxY(content_frame));
arrow = views::BubbleBorder::TOP_CENTER;
}
gfx::Point anchor_point = ScreenPointFromBrowser(browser, ns_anchor_point);
gfx::NativeView parent =
platform_util::GetViewForWindow(browser->window()->GetNativeWindow());
DCHECK(parent);
LocationBarBubbleDelegateView::DisplayReason reason =
user_action ? LocationBarBubbleDelegateView::USER_GESTURE
: LocationBarBubbleDelegateView::AUTOMATIC;
PasswordBubbleViewBase* bubble_view = PasswordBubbleViewBase::CreateBubble(
web_contents(), nullptr, anchor_point, reason);
bubble_view->SetArrow(arrow);
bubble_view->set_parent_window(parent);
views::BubbleDialogDelegateView::CreateBubble(bubble_view);
bubble_view->ShowForReason(reason);
KeepBubbleAnchored(bubble_view, GetManagePasswordDecoration(window));
}
void TabDialogsViewsMac::HideManagePasswordsBubble() {
// Close toolkit-views bubble.
if (!PasswordBubbleViewBase::manage_password_bubble())
return;
const content::WebContents* bubble_web_contents =
PasswordBubbleViewBase::manage_password_bubble()->GetWebContents();
if (web_contents() == bubble_web_contents)
PasswordBubbleViewBase::CloseCurrentBubble();
}
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h" #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.h"
#endif #endif
#if !defined(OS_MACOSX)
// static // static
void TabDialogs::CreateForWebContents(content::WebContents* contents) { void TabDialogs::CreateForWebContents(content::WebContents* contents) {
DCHECK(contents); DCHECK(contents);
...@@ -27,7 +26,6 @@ void TabDialogs::CreateForWebContents(content::WebContents* contents) { ...@@ -27,7 +26,6 @@ void TabDialogs::CreateForWebContents(content::WebContents* contents) {
std::make_unique<TabDialogsViews>(contents)); std::make_unique<TabDialogsViews>(contents));
} }
} }
#endif
TabDialogsViews::TabDialogsViews(content::WebContents* contents) TabDialogsViews::TabDialogsViews(content::WebContents* contents)
: web_contents_(contents) { : web_contents_(contents) {
......
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