summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 22:58:58 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-19 22:58:58 +0000
commitb11953f046bbe1637041981df4a434cb96b8df30 (patch)
tree765d8337bb16b4f023006c1b2f88edb1097671db /chrome
parent7be87f35e7b4ebbb92c298f998008be6ac33ecc2 (diff)
downloadchromium_src-b11953f046bbe1637041981df4a434cb96b8df30.zip
chromium_src-b11953f046bbe1637041981df4a434cb96b8df30.tar.gz
chromium_src-b11953f046bbe1637041981df4a434cb96b8df30.tar.bz2
Mac Canary: Don't offer to set as the default browser.
This includes some light refactoring to give all platforms a platform_util::CanSetAsDefaultBrowser() function. The .xib change links the set-as-default button with the new IBOutlet. BUG=79814 TEST=Canary.app should never offer to set as the default browser in the first run dialog or in an infobar. Review URL: http://codereview.chromium.org/6881058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/nibs/FirstRunDialog.xib58
-rw-r--r--chrome/browser/platform_util.h5
-rw-r--r--chrome/browser/platform_util_common_linux.cc4
-rw-r--r--chrome/browser/platform_util_mac.mm4
-rw-r--r--chrome/browser/platform_util_win.cc5
-rw-r--r--chrome/browser/shell_integration_mac.mm8
-rw-r--r--chrome/browser/ui/browser_init.cc9
-rw-r--r--chrome/browser/ui/cocoa/first_run_dialog.h3
-rw-r--r--chrome/browser/ui/cocoa/first_run_dialog.mm6
9 files changed, 81 insertions, 21 deletions
diff --git a/chrome/app/nibs/FirstRunDialog.xib b/chrome/app/nibs/FirstRunDialog.xib
index 773172f..cf2caf6 100644
--- a/chrome/app/nibs/FirstRunDialog.xib
+++ b/chrome/app/nibs/FirstRunDialog.xib
@@ -2,17 +2,16 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10F2108</string>
- <string key="IBDocument.InterfaceBuilderVersion">823</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
+ <string key="IBDocument.SystemVersion">10J869</string>
+ <string key="IBDocument.InterfaceBuilderVersion">851</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">823</string>
+ <string key="NS.object.0">851</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -46,7 +45,7 @@
<string key="NSWindowTitle">^IDS_FIRSTRUN_DLG_MAC_WINDOW_TITLE$IDS_PRODUCT_NAME</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
- <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
@@ -57,6 +56,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{45, 128}, {389, 18}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1019469145">
<int key="NSCellFlags">67239424</int>
@@ -98,6 +98,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{13, 25}, {390, 17}}</string>
<reference key="NSSuperview" ref="892364686"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="737321925">
<int key="NSCellFlags">68288064</int>
@@ -111,7 +112,7 @@
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
+ <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor" id="791758296">
@@ -142,6 +143,7 @@
</object>
<string key="NSFrame">{{408, -25}, {96, 96}}</string>
<reference key="NSSuperview" ref="892364686"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSImageCell" key="NSCell" id="80479895">
<int key="NSCellFlags">130560</int>
@@ -160,10 +162,12 @@
</object>
<string key="NSFrameSize">{480, 55}</string>
<reference key="NSSuperview" ref="728826967"/>
+ <reference key="NSWindow"/>
</object>
</object>
<string key="NSFrame">{{0, 197}, {480, 55}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -185,7 +189,7 @@
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
</object>
</object>
<reference key="NSContentView" ref="892364686"/>
@@ -200,6 +204,7 @@
<int key="NSvFlags">10</int>
<string key="NSFrame">{{0, 194}, {480, 5}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -209,7 +214,7 @@
<reference key="NSBackgroundColor" ref="469450765"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
</object>
</object>
<int key="NSBorderType">3</int>
@@ -222,6 +227,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{28, 152}, {435, 17}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="186162046">
<int key="NSCellFlags">68288064</int>
@@ -238,6 +244,7 @@
<int key="NSvFlags">10</int>
<string key="NSFrame">{{-1, 57}, {480, 5}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
<int key="NSCellFlags">67239424</int>
@@ -247,7 +254,7 @@
<reference key="NSBackgroundColor" ref="469450765"/>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MCAwLjgwMDAwMDAxAA</bytes>
+ <bytes key="NSWhite">MCAwLjgwMDAwMDAxMTkAA</bytes>
</object>
</object>
<int key="NSBorderType">3</int>
@@ -260,6 +267,7 @@
<int key="NSvFlags">266</int>
<string key="NSFrame">{{45, 103}, {389, 19}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="645476742">
<int key="NSCellFlags">-2080244224</int>
@@ -287,6 +295,7 @@
<int key="NSvFlags">289</int>
<string key="NSFrame">{{14, 12}, {306, 32}}</string>
<reference key="NSSuperview" ref="913870182"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="685620085">
<int key="NSCellFlags">67239424</int>
@@ -305,6 +314,7 @@
</object>
<string key="NSFrame">{{146, 0}, {334, 52}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<string key="NSClassName">GTMWidthBasedTweaker</string>
</object>
<object class="NSButton" id="575991284">
@@ -312,6 +322,7 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{63, 80}, {359, 19}}</string>
<reference key="NSSuperview" ref="1006"/>
+ <reference key="NSWindow"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="955346791">
<int key="NSCellFlags">-2080244224</int>
@@ -329,9 +340,10 @@
</object>
<string key="NSFrameSize">{480, 248}</string>
<reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
- <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
+ <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string>
</object>
<object class="NSCustomObject" id="689012122">
<string key="NSClassName">ChromeUILocalizer</string>
@@ -463,6 +475,14 @@
</object>
<int key="connectionID">130</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">setAsDefaultCheckbox_</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="328877840"/>
+ </object>
+ <int key="connectionID">131</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -737,7 +757,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">130</int>
+ <int key="maxID">131</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -790,12 +810,14 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>objectsToSize_</string>
+ <string>setAsDefaultCheckbox_</string>
<string>statsCheckbox_</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSArray</string>
<string>NSButton</string>
+ <string>NSButton</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
@@ -803,6 +825,7 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>objectsToSize_</string>
+ <string>setAsDefaultCheckbox_</string>
<string>statsCheckbox_</string>
</object>
<object class="NSMutableArray" key="dict.values">
@@ -812,6 +835,10 @@
<string key="candidateClassName">NSArray</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">setAsDefaultCheckbox_</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">statsCheckbox_</string>
<string key="candidateClassName">NSButton</string>
</object>
@@ -1017,6 +1044,13 @@
<string key="className">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">browser/ui/cocoa/nsview_additions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
<string key="minorKey">browser/ui/cocoa/view_id_util.h</string>
</object>
</object>
diff --git a/chrome/browser/platform_util.h b/chrome/browser/platform_util.h
index 37d5171..41fa0ed 100644
--- a/chrome/browser/platform_util.h
+++ b/chrome/browser/platform_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -60,6 +60,9 @@ bool SimpleYesNoBox(gfx::NativeWindow parent,
// beta, but "" for stable).
std::string GetVersionStringModifier();
+// Returns true if the running browser can be set as the default browser.
+bool CanSetAsDefaultBrowser();
+
}
#endif // CHROME_BROWSER_PLATFORM_UTIL_H_
diff --git a/chrome/browser/platform_util_common_linux.cc b/chrome/browser/platform_util_common_linux.cc
index feb1568..195dc66 100644
--- a/chrome/browser/platform_util_common_linux.cc
+++ b/chrome/browser/platform_util_common_linux.cc
@@ -134,4 +134,8 @@ std::string GetVersionStringModifier() {
return modifier;
}
+bool CanSetAsDefaultBrowser() {
+ return true;
+}
+
} // namespace platform_util
diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm
index 8cd5851..9a61775 100644
--- a/chrome/browser/platform_util_mac.mm
+++ b/chrome/browser/platform_util_mac.mm
@@ -209,4 +209,8 @@ std::string GetVersionStringModifier() {
#endif
}
+bool CanSetAsDefaultBrowser() {
+ return GetVersionStringModifier().compare("canary") != 0;
+}
+
} // namespace platform_util
diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc
index af1449c..2076b64 100644
--- a/chrome/browser/platform_util_win.cc
+++ b/chrome/browser/platform_util_win.cc
@@ -19,6 +19,7 @@
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/scoped_comptr.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/install_util.h"
@@ -211,4 +212,8 @@ std::string GetVersionStringModifier() {
#endif
}
+bool CanSetAsDefaultBrowser() {
+ return BrowserDistribution::GetDistribution()->CanSetAsDefault();
+}
+
} // namespace platform_util
diff --git a/chrome/browser/shell_integration_mac.mm b/chrome/browser/shell_integration_mac.mm
index 15258a9..7bf1dcb 100644
--- a/chrome/browser/shell_integration_mac.mm
+++ b/chrome/browser/shell_integration_mac.mm
@@ -1,15 +1,19 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/shell_integration.h"
#include "base/mac/mac_util.h"
+#include "chrome/browser/platform_util.h"
#import "third_party/mozilla/NSWorkspace+Utils.h"
// Sets Chromium as default browser (only for current user). Returns false if
-// this operation fails (which we can't check for).
+// this operation fails.
bool ShellIntegration::SetAsDefaultBrowser() {
+ if (!platform_util::CanSetAsDefaultBrowser())
+ return false;
+
// We really do want the main bundle here, not base::mac::MainAppBundle(),
// which is the bundle for the framework.
NSString* identifier = [[NSBundle mainBundle] bundleIdentifier];
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 7f94444..71cd400 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
@@ -283,12 +284,10 @@ CheckDefaultBrowserTask::~CheckDefaultBrowserTask() {
}
void CheckDefaultBrowserTask::Run() {
- if (ShellIntegration::IsDefaultBrowser())
+ if (ShellIntegration::IsDefaultBrowser() ||
+ !platform_util::CanSetAsDefaultBrowser()) {
return;
-#if defined(OS_WIN)
- if (!BrowserDistribution::GetDistribution()->CanSetAsDefault())
- return;
-#endif
+ }
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
new NotifyNotDefaultBrowserTask());
}
diff --git a/chrome/browser/ui/cocoa/first_run_dialog.h b/chrome/browser/ui/cocoa/first_run_dialog.h
index 3e575a3..92d529d 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog.h
+++ b/chrome/browser/ui/cocoa/first_run_dialog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,6 +17,7 @@
BOOL makeDefaultBrowser_;
IBOutlet NSArray* objectsToSize_;
+ IBOutlet NSButton* setAsDefaultCheckbox_;
IBOutlet NSButton* statsCheckbox_;
BOOL beenSized_;
}
diff --git a/chrome/browser/ui/cocoa/first_run_dialog.mm b/chrome/browser/ui/cocoa/first_run_dialog.mm
index 2b4d052..15fb608 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog.mm
+++ b/chrome/browser/ui/cocoa/first_run_dialog.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/first_run/first_run_dialog.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
#import "chrome/browser/ui/cocoa/search_engine_dialog_controller.h"
@@ -187,6 +188,11 @@ void ShowFirstRunDialog(Profile* profile,
- (void)show {
NSWindow* win = [self window];
+ if (!platform_util::CanSetAsDefaultBrowser()) {
+ [setAsDefaultCheckbox_ setHidden:YES];
+ makeDefaultBrowser_ = NO;
+ }
+
// Only support the sizing the window once.
DCHECK(!beenSized_) << "ShowWindow was called twice?";
if (!beenSized_) {