diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 16:28:21 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 16:28:21 +0000 |
commit | 92b533a37663e7f11b8150b70f8c70814a3ef402 (patch) | |
tree | 32bd1cbe0e2d92e3d46d605538da7ba0e6553d20 | |
parent | 4bd52508301d65a49430e15e1b70631b0f56b4e6 (diff) | |
download | chromium_src-92b533a37663e7f11b8150b70f8c70814a3ef402.zip chromium_src-92b533a37663e7f11b8150b70f8c70814a3ef402.tar.gz chromium_src-92b533a37663e7f11b8150b70f8c70814a3ef402.tar.bz2 |
[Mac] Remove the PageInfoWindow now that the Bubble is finished.
BUG=59030
TEST=compile
Review URL: http://codereview.chromium.org/3837004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62932 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/browser_window_cocoa.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/page_info_window_controller.h | 31 | ||||
-rw-r--r-- | chrome/browser/cocoa/page_info_window_controller.mm | 63 | ||||
-rw-r--r-- | chrome/browser/cocoa/page_info_window_mac.h | 79 | ||||
-rw-r--r-- | chrome/browser/cocoa/page_info_window_mac.mm | 222 | ||||
-rw-r--r-- | chrome/browser/cocoa/page_info_window_mac_unittest.mm | 203 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 3 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 |
8 files changed, 4 insertions, 600 deletions
diff --git a/chrome/browser/cocoa/browser_window_cocoa.mm b/chrome/browser/cocoa/browser_window_cocoa.mm index 1df0560..846b4ca 100644 --- a/chrome/browser/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/cocoa/browser_window_cocoa.mm @@ -26,7 +26,6 @@ #import "chrome/browser/cocoa/keyword_editor_cocoa_controller.h" #import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h" #import "chrome/browser/cocoa/nsmenuitem_additions.h" -#include "chrome/browser/cocoa/page_info_window_mac.h" #include "chrome/browser/cocoa/repost_form_warning_mac.h" #include "chrome/browser/cocoa/restart_browser.h" #include "chrome/browser/cocoa/status_bubble_mac.h" @@ -35,6 +34,7 @@ #import "chrome/browser/cocoa/toolbar_controller.h" #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/global_keyboard_shortcuts_mac.h" +#include "chrome/browser/page_info_window.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" #include "chrome/browser/sidebar/sidebar_container.h" diff --git a/chrome/browser/cocoa/page_info_window_controller.h b/chrome/browser/cocoa/page_info_window_controller.h deleted file mode 100644 index 4a9624c..0000000 --- a/chrome/browser/cocoa/page_info_window_controller.h +++ /dev/null @@ -1,31 +0,0 @@ -// 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. - -#import <Cocoa/Cocoa.h> - -#include "base/scoped_nsobject.h" -#include "base/scoped_ptr.h" - -class PageInfoWindowMac; -class PrefService; -@class WindowSizeAutosaver; - -// This NSWindowController subclass implements the Cocoa window for -// PageInfoWindow. This creates and owns the PageInfoWindowMac subclass. - -@interface PageInfoWindowController : NSWindowController { - @private - // Bridge to Chromium that we own. - scoped_ptr<PageInfoWindowMac> pageInfo_; - - scoped_nsobject<WindowSizeAutosaver> sizeSaver_; -} - -// Sets the bridge between Cocoa and Chromium. -- (void)setPageInfo:(PageInfoWindowMac*)pageInfo; - -// Shows the certificate display window -- (IBAction)showCertWindow:(id)sender; - -@end diff --git a/chrome/browser/cocoa/page_info_window_controller.mm b/chrome/browser/cocoa/page_info_window_controller.mm deleted file mode 100644 index 3a699d7..0000000 --- a/chrome/browser/cocoa/page_info_window_controller.mm +++ /dev/null @@ -1,63 +0,0 @@ -// 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. - -#import "chrome/browser/cocoa/page_info_window_controller.h" - -#include "app/l10n_util_mac.h" -#include "base/mac_util.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/cocoa/page_info_window_mac.h" -#include "chrome/browser/cocoa/window_size_autosaver.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/common/pref_names.h" -#include "grit/generated_resources.h" - -namespace { - -// The width of the window. The height will be determined by the content. -const NSInteger kWindowWidth = 460; - -} // namespace - -@implementation PageInfoWindowController - -- (id)init { - NSUInteger styleMask = NSTitledWindowMask | NSClosableWindowMask | - NSMiniaturizableWindowMask; - scoped_nsobject<NSWindow> window( - // Use an arbitrary height because it will be changed by the bridge. - [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, kWindowWidth, 100) - styleMask:styleMask - backing:NSBackingStoreBuffered - defer:NO]); - if ((self = [super initWithWindow:window.get()])) { - [window setTitle: - l10n_util::GetNSStringWithFixup(IDS_PAGEINFO_WINDOW_TITLE)]; - [window setDelegate:self]; - - if (g_browser_process && g_browser_process->local_state()) { - sizeSaver_.reset([[WindowSizeAutosaver alloc] - initWithWindow:[self window] - prefService:g_browser_process->local_state() - path:prefs::kPageInfoWindowPlacement]); - } - } - return self; -} - -- (void)setPageInfo:(PageInfoWindowMac*)pageInfo { - pageInfo_.reset(pageInfo); -} - -- (IBAction)showCertWindow:(id)sender { - pageInfo_->ShowCertDialog(0); // Pass it any int because it's ignored. -} - -// If the page info window gets closed, we have nothing left to manage and we -// can clean ourselves up. -- (void)windowWillClose:(NSNotification*)notif { - [self autorelease]; -} - -@end diff --git a/chrome/browser/cocoa/page_info_window_mac.h b/chrome/browser/cocoa/page_info_window_mac.h deleted file mode 100644 index a8abbc4..0000000 --- a/chrome/browser/cocoa/page_info_window_mac.h +++ /dev/null @@ -1,79 +0,0 @@ -// 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_COCOA_PAGE_INFO_WINDOW_MAC_H_ -#define CHROME_BROWSER_COCOA_PAGE_INFO_WINDOW_MAC_H_ -#pragma once - -#import <Cocoa/Cocoa.h> - -#include "base/scoped_nsobject.h" -#include "base/scoped_ptr.h" -#include "chrome/browser/page_info_model.h" -#include "chrome/browser/page_info_window.h" - -class Profile; -@class PageInfoWindowController; - -namespace { -class PageInfoWindowMacTest; -}; - -// This bridge is responsible for getting information from the cross-platform -// model and dynamically creating the contents of the window. The controller is -// responsible for managing the window's memory and user events (pressing on -// the Show Certificate button). -class PageInfoWindowMac : public PageInfoModel::PageInfoModelObserver { - public: - virtual ~PageInfoWindowMac(); - - // Used to create the page info window; called from the cross-platform - // function. - static void ShowPageInfo(gfx::NativeWindow parent, - Profile* profile, - const GURL& url, - const NavigationEntry::SSLStatus& ssl, - bool show_history); - - // Shows various information for the specified certificate in a new dialog. - // The argument is ignored here and we use the |cert_id_| member that was - // passed to us in Init(). - virtual void ShowCertDialog(int); - - // PageInfoModelObserver implementation. - virtual void ModelChanged(); - - private: - friend class ::PageInfoWindowMacTest; - - // Constructor; private. Called by ShowPageInfo(). - PageInfoWindowMac(PageInfoWindowController* controller, - Profile* profile, - const GURL& url, - const NavigationEntry::SSLStatus& ssl, - bool show_history); - - // Testing constructor. DO NOT USE. - PageInfoWindowMac(PageInfoWindowController* controller, - PageInfoModel* model); - - // Dynamically creates the window's content section. - void LayoutSections(); - - // Shows the actual window. - void Show(); - - // The window controller that manages the memory and window reference. - PageInfoWindowController* controller_; // WEAK, owns us. - - // The platform-independent model for the info window. - scoped_ptr<PageInfoModel> model_; - - // The certificate ID for the page, 0 if the page is not over HTTPS. - int cert_id_; - - DISALLOW_COPY_AND_ASSIGN(PageInfoWindowMac); -}; - -#endif // CHROME_BROWSER_COCOA_PAGE_INFO_WINDOW_MAC_H_ diff --git a/chrome/browser/cocoa/page_info_window_mac.mm b/chrome/browser/cocoa/page_info_window_mac.mm index 2774e1e..15b3e7f 100644 --- a/chrome/browser/cocoa/page_info_window_mac.mm +++ b/chrome/browser/cocoa/page_info_window_mac.mm @@ -2,49 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/cocoa/page_info_window_mac.h" - -#include <algorithm> - -#include "app/l10n_util.h" -#include "app/resource_bundle.h" -#include "base/string_util.h" -#include "base/sys_string_conversions.h" -#import "chrome/browser/cocoa/page_info_window_controller.h" -#include "chrome/browser/cert_store.h" -#include "chrome/browser/certificate_viewer.h" #include "chrome/browser/page_info_window.h" -#include "chrome/browser/profile.h" -#include "grit/generated_resources.h" -#include "grit/theme_resources.h" -#include "net/base/cert_status_flags.h" -#include "net/base/x509_certificate.h" -#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" - -namespace { - -// Spacing in between section boxes. -const NSInteger kVerticalSpacing = 10; - -// Padding from the edge of the boxes and the window frame. -const NSInteger kFramePadding = 20; -// Spacing between the frame of the box and the left edge of the image and the -// right edge of the text. -const NSInteger kBoxHorizontalSpacing = 13; +#include "base/logging.h" -// Spacing between the top/bottom of the box frame and the top of the image and -// text components. -const NSInteger kBoxTopSpacing = 33; -const NSInteger kBoxBottomSpacing = 7; - -// Spacing between the image and the text. -const NSInteger kImageSpacing = 10; - -// Square size of the image. -const CGFloat kImageSize = 30; - -} // namespace +// TODO(finnur): Delete this file. http://crbug.com/59030 namespace browser { @@ -53,185 +15,7 @@ void ShowPageInfo(gfx::NativeWindow parent, const GURL& url, const NavigationEntry::SSLStatus& ssl, bool show_history) { - PageInfoWindowMac::ShowPageInfo(parent, profile, url, ssl, show_history); + NOTREACHED(); } } // namespace browser - -PageInfoWindowMac::PageInfoWindowMac(PageInfoWindowController* controller, - Profile* profile, - const GURL& url, - const NavigationEntry::SSLStatus& ssl, - bool show_history) - : controller_(controller), - model_(new PageInfoModel(profile, url, ssl, show_history, this)), - cert_id_(ssl.cert_id()) { -} - -PageInfoWindowMac::PageInfoWindowMac(PageInfoWindowController* controller, - PageInfoModel* model) - : controller_(controller), - model_(model), - cert_id_(0) { -} - -// static -void PageInfoWindowMac::ShowPageInfo(gfx::NativeWindow parent, - Profile* profile, - const GURL& url, - const NavigationEntry::SSLStatus& ssl, - bool show_history) { - // The controller will clean itself up after the NSWindow it manages closes. - // We do not manage it as it owns us. - PageInfoWindowController* controller = - [[PageInfoWindowController alloc] init]; - PageInfoWindowMac* page_info = new PageInfoWindowMac(controller, - profile, - url, - ssl, - show_history); - [controller setPageInfo:page_info]; - page_info->LayoutSections(); - page_info->Show(); -} - -PageInfoWindowMac::~PageInfoWindowMac() { -} - -void PageInfoWindowMac::ShowCertDialog(int) { - DCHECK(cert_id_ != 0); - ShowCertificateViewerByID([controller_ window], cert_id_); -} - -void PageInfoWindowMac::ModelChanged() { - LayoutSections(); -} - -void PageInfoWindowMac::Show() { - [[controller_ window] makeKeyAndOrderFront:nil]; -} - -// This will create the subviews for the page info window. The general layout -// is 2 or 3 boxed and titled sections, each of which has a status image to -// provide visual feedback and a description that explains it. The description -// text is usually only 1 or 2 lines, but can be much longer. At the bottom of -// the window is a button to view the SSL certificate, which is disabled if -// not using HTTPS. -void PageInfoWindowMac::LayoutSections() { - NSRect window_frame = [[controller_ window] frame]; - CGFloat window_width = NSWidth(window_frame); - // |offset| is the Y position that should be drawn at next. - CGFloat offset = kFramePadding; - - // Keep the new subviews in an array that gets replaced at the end. - NSMutableArray* subviews = [NSMutableArray array]; - - // Create the certificate button. The frame will be fixed up by GTM, so use - // arbitrary values. - NSRect button_rect = NSMakeRect(kFramePadding, offset, 100, 20); - scoped_nsobject<NSButton> cert_button( - [[NSButton alloc] initWithFrame:button_rect]); - [cert_button setTitle: - l10n_util::GetNSStringWithFixup(IDS_PAGEINFO_CERT_INFO_BUTTON)]; - [cert_button setButtonType:NSMomentaryPushInButton]; - [cert_button setBezelStyle:NSRoundedBezelStyle]; - // The default button will use control size font, not the system/button font. - [cert_button setFont:[NSFont systemFontOfSize:0]]; - [cert_button setTarget:controller_]; - [cert_button setAction:@selector(showCertWindow:)]; - [subviews addObject:cert_button.get()]; - [GTMUILocalizerAndLayoutTweaker sizeToFitView:cert_button]; - offset += NSHeight(button_rect) + kFramePadding; - - // Small font for the description labels. - NSFont* font = [NSFont labelFontOfSize:11]; - - // Calculate some common, constant values. - const CGFloat box_width = window_width - (2 * kFramePadding); - const CGFloat text_width = - box_width - (kBoxHorizontalSpacing + kImageSize + - kImageSpacing + kBoxHorizontalSpacing * 2); - const CGFloat text_x = kBoxHorizontalSpacing + kImageSize + kImageSpacing; - - // Build the window from bottom-up because Cocoa's coordinate origin is the - // lower left. - for (int i = model_->GetSectionCount() - 1; i >= 0; --i) { - PageInfoModel::SectionInfo info = model_->GetSectionInfo(i); - - // Create the text field first, because that informs how large to make the - // box it goes in. - NSRect text_field_rect = - NSMakeRect(text_x, kBoxBottomSpacing, text_width, kImageSpacing); - scoped_nsobject<NSTextField> text_field( - [[NSTextField alloc] initWithFrame:text_field_rect]); - [text_field setEditable:NO]; - [text_field setDrawsBackground:NO]; - [text_field setBezeled:NO]; - [text_field setStringValue:base::SysUTF16ToNSString(info.description)]; - [text_field setFont:font]; - - // If the text is oversized, resize the text field. - text_field_rect.size.height += - [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField: - text_field]; - - // Make the box, sized to fit the text. It should be at least large enough - // to contain the height of the image, which is larger than a single line - // of text. - CGFloat box_height = kBoxTopSpacing + - std::max(NSHeight(text_field_rect), kImageSize) + kBoxBottomSpacing; - NSRect box_rect = NSMakeRect(kFramePadding, offset, box_width, box_height); - scoped_nsobject<NSBox> box([[NSBox alloc] initWithFrame:box_rect]); - [box setTitlePosition:NSAtTop]; - [box setTitle:base::SysUTF16ToNSString(info.title)]; - offset += box_height + kVerticalSpacing; - - // Re-position the text field's origin now that the box height is known. - text_field_rect.origin.y = box_height - - (NSHeight(text_field_rect) + kBoxTopSpacing); - [text_field setFrame:text_field_rect]; - - // Insert the image subview. - NSRect image_view_rect = - NSMakeRect(kBoxHorizontalSpacing, - box_height - (kImageSize + kBoxTopSpacing), - kImageSize, kImageSize); - scoped_nsobject<NSImageView> image_view( - [[NSImageView alloc] initWithFrame:image_view_rect]); - [image_view setImageFrameStyle:NSImageFrameNone]; - [image_view setImage:model_->GetIconImage(info.icon_id)]; - - // Add the box to the list of new subviews. - [box addSubview:image_view.get()]; - [box addSubview:text_field.get()]; - [subviews addObject:box.get()]; - } - - // Replace the window's content. - [[[controller_ window] contentView] setSubviews:subviews]; - - // Just setting |size| will cause the window to grow upwards. Shift the - // origin up by grow amount, which causes the window to grow downwards. - offset += kFramePadding; - window_frame.origin.y -= offset - window_frame.size.height; - window_frame.size.height = offset; - - // By default, assume that we don't have certificate information to show. - [cert_button setEnabled:NO]; - if (cert_id_) { - scoped_refptr<net::X509Certificate> cert; - CertStore::GetSharedInstance()->RetrieveCert(cert_id_, &cert); - - // Don't bother showing certificates if there isn't one. Gears runs with no - // os root certificate. - if (cert.get() && cert->os_cert_handle()) { - [cert_button setEnabled:YES]; - } - } - - // Resize the window. Only animate if the window is visible, otherwise it - // could be "growing" while it's opening, looking awkward. - [[controller_ window] setFrame:window_frame - display:YES - animate:[[controller_ window] isVisible]]; -} diff --git a/chrome/browser/cocoa/page_info_window_mac_unittest.mm b/chrome/browser/cocoa/page_info_window_mac_unittest.mm deleted file mode 100644 index d3db57e..0000000 --- a/chrome/browser/cocoa/page_info_window_mac_unittest.mm +++ /dev/null @@ -1,203 +0,0 @@ -// 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. - -#include "app/l10n_util.h" -#include "base/scoped_nsobject.h" -#include "base/string_util.h" -#include "base/string_number_conversions.h" -#include "base/sys_string_conversions.h" -#include "base/utf_string_conversions.h" -#import "chrome/browser/cocoa/page_info_window_mac.h" -#import "chrome/browser/cocoa/page_info_window_controller.h" -#include "chrome/browser/cocoa/browser_test_helper.h" -#import "chrome/browser/cocoa/cocoa_test_helper.h" -#include "chrome/browser/page_info_model.h" -#include "grit/generated_resources.h" - -namespace { - -class FakeModel : public PageInfoModel { - public: - FakeModel() : PageInfoModel() {} - - void AddSection(SectionStateIcon icon_id, - const string16& title, - const string16& description, - SectionInfoType type) { - sections_.push_back(SectionInfo( - icon_id, - title, - string16(), - description, - type)); - } -}; - -class PageInfoWindowMacTest : public CocoaTest { - public: - virtual void SetUp() { - CocoaTest::SetUp(); - - // The controller cleans up after itself when the window closes. - controller_ = [[PageInfoWindowController alloc] init]; - window_ = [controller_ window]; - - // The bridge will own the model. - model_ = new FakeModel(); - - // The controller will take ownership of the bridge. - bridge_ = new PageInfoWindowMac(controller_, model_); - [controller_ setPageInfo:bridge_]; - EXPECT_TRUE([controller_ window]); - } - - virtual void TearDown() { - [controller_ close]; - CocoaTest::TearDown(); - } - - // Checks the controller's window for the requisite subviews in the given - // numbers. - void CheckWindow(int button_count, int box_count) { - for (NSView* view in [[window_ contentView] subviews]) { - if ([view isKindOfClass:[NSButton class]]) { - --button_count; - CheckButton(static_cast<NSButton*>(view)); - } else if ([view isKindOfClass:[NSBox class]]) { - --box_count; - CheckBox(static_cast<NSBox*>(view)); - } else { - EXPECT_TRUE(false) << "Unknown subview"; - } - } - EXPECT_EQ(0, button_count); - EXPECT_EQ(0, box_count); - EXPECT_EQ([window_ delegate], controller_); - } - - // Checks that a button is hooked up correctly. - void CheckButton(NSButton* button) { - EXPECT_EQ(@selector(showCertWindow:), [button action]); - EXPECT_EQ(controller_, [button target]); - EXPECT_TRUE([button stringValue]); - } - - // Makes sure the box has a valid image and a string. - void CheckBox(NSBox* box) { - EXPECT_TRUE([box title]); - NSArray* subviews = [[box contentView] subviews]; - EXPECT_EQ(2U, [subviews count]); - for (NSView* view in subviews) { - if ([view isKindOfClass:[NSImageView class]]) { - NSImageView* image_view = static_cast<NSImageView*>(view); - EXPECT_TRUE([image_view image]); - } else if ([view isKindOfClass:[NSTextField class]]) { - NSTextField* text_field = static_cast<NSTextField*>(view); - EXPECT_LT(0U, [[text_field stringValue] length]); - } else { - EXPECT_TRUE(false) << "Unknown box subview"; - } - } - } - - BrowserTestHelper helper_; - - PageInfoWindowController* controller_; // Weak, owns self. - PageInfoWindowMac* bridge_; // Weak, owned by controller. - FakeModel* model_; // Weak, owned by bridge. - - NSWindow* window_; // Weak, owned by controller. -}; - - -TEST_F(PageInfoWindowMacTest, NoHistoryNoSecurity) { - model_->AddSection(PageInfoModel::ICON_STATE_ERROR, - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY), - PageInfoModel::SECTION_INFO_IDENTITY); - model_->AddSection(PageInfoModel::ICON_STATE_ERROR, - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), - l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, - ASCIIToUTF16("google.com")), - PageInfoModel::SECTION_INFO_CONNECTION); - - bridge_->ModelChanged(); - - CheckWindow(1, 2); -} - - -TEST_F(PageInfoWindowMacTest, HistoryNoSecurity) { - model_->AddSection(PageInfoModel::ICON_STATE_ERROR, - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_UNKNOWN_PARTY), - PageInfoModel::SECTION_INFO_IDENTITY); - model_->AddSection(PageInfoModel::ICON_STATE_ERROR, - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE), - l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, - ASCIIToUTF16("google.com")), - PageInfoModel::SECTION_INFO_CONNECTION); - - // In practice, the history information comes later because it's queried - // asynchronously, so replicate the double-build here. - bridge_->ModelChanged(); - - model_->AddSection(PageInfoModel::ICON_STATE_ERROR, - l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SECURITY_TAB_PERSONAL_HISTORY_TITLE), - l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY), - PageInfoModel::SECTION_INFO_FIRST_VISIT); - - bridge_->ModelChanged(); - - CheckWindow(1, 3); -} - - -TEST_F(PageInfoWindowMacTest, NoHistoryMixedSecurity) { - model_->AddSection(PageInfoModel::ICON_STATE_OK, - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_IDENTITY_TITLE), - l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY, - ASCIIToUTF16("Goat Security Systems")), - PageInfoModel::SECTION_INFO_IDENTITY); - - // This string is super long and the text should overflow the default clip - // region (kImageSize). - string16 title = - l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_CONNECTION_TITLE); - model_->AddSection(PageInfoModel::ICON_STATE_OK, - title, - l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, - l10n_util::GetStringFUTF16( - IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, - ASCIIToUTF16("chrome.google.com"), - base::IntToString16(1024)), - l10n_util::GetStringUTF16( - IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)), - PageInfoModel::SECTION_INFO_CONNECTION); - - bridge_->ModelChanged(); - - NSArray* subviews = [[window_ contentView] subviews]; - CheckWindow(1, 2); - - // Look for the over-sized box. - NSString* targetTitle = base::SysUTF16ToNSString(title); - for (NSView* subview in subviews) { - if ([subview isKindOfClass:[NSBox class]]) { - NSBox* box = static_cast<NSBox*>(subview); - if ([[box title] isEqualToString:targetTitle]) { - // Typical box frame is ~55px, make sure this is extra large. - EXPECT_LT(75, NSHeight([box frame])); - } - } - } -} - -} // namespace diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index cef59c2..9001013 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1103,9 +1103,6 @@ 'browser/cocoa/objc_zombie.mm', 'browser/cocoa/page_info_bubble_controller.h', 'browser/cocoa/page_info_bubble_controller.mm', - 'browser/cocoa/page_info_window_controller.h', - 'browser/cocoa/page_info_window_controller.mm', - 'browser/cocoa/page_info_window_mac.h', 'browser/cocoa/page_info_window_mac.mm', 'browser/cocoa/preferences_window_controller.h', 'browser/cocoa/preferences_window_controller.mm', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 03677f0..e842e4f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1192,7 +1192,6 @@ 'browser/cocoa/nsmenuitem_additions_unittest.mm', 'browser/cocoa/objc_method_swizzle_unittest.mm', 'browser/cocoa/page_info_bubble_controller_unittest.mm', - 'browser/cocoa/page_info_window_mac_unittest.mm', 'browser/cocoa/preferences_window_controller_unittest.mm', 'browser/cocoa/previewable_contents_controller_unittest.mm', 'browser/cocoa/reload_button_unittest.mm', |