Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6473)

Unified Diff: chrome/browser/ui/cocoa/select_file_dialog_mac.mm

Issue 9982014: Make common utility to load views from nibs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retain autorelease Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/shell/shell_login_dialog_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/select_file_dialog_mac.mm
diff --git a/chrome/browser/ui/cocoa/select_file_dialog_mac.mm b/chrome/browser/ui/cocoa/select_file_dialog_mac.mm
index 902034d1ffe0582f386741beded667886d8e7914..37cbb83ceb4bdebe6e8b6da4a69c5a81ec54549c 100644
--- a/chrome/browser/ui/cocoa/select_file_dialog_mac.mm
+++ b/chrome/browser/ui/cocoa/select_file_dialog_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// 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.
@@ -21,9 +21,14 @@
#include "base/sys_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "grit/generated_resources.h"
+#import "ui/base/cocoa/nib_loading.h"
#include "ui/base/l10n/l10n_util_mac.h"
-static const int kFileTypePopupTag = 1234;
+namespace {
+
+const int kFileTypePopupTag = 1234;
+
+} // namespace
class SelectFileDialogImpl;
@@ -294,27 +299,9 @@ void SelectFileDialogImpl::FileWasSelected(NSSavePanel* dialog,
NSView* SelectFileDialogImpl::GetAccessoryView(const FileTypeInfo* file_types,
int file_type_index) {
DCHECK(file_types);
- scoped_nsobject<NSNib> nib (
- [[NSNib alloc] initWithNibNamed:@"SaveAccessoryView"
- bundle:base::mac::FrameworkBundle()]);
- if (!nib)
- return nil;
-
- NSArray* objects;
- BOOL success = [nib instantiateNibWithOwner:nil
- topLevelObjects:&objects];
- if (!success)
+ NSView* accessory_view = ui::GetViewFromNib(@"SaveAccessoryView");
+ if (!accessory_view)
return nil;
- [objects makeObjectsPerformSelector:@selector(release)];
-
- // This is a one-object nib, but IB insists on creating a second object, the
- // NSApplication. I don't know why.
- size_t view_index = 0;
- while (view_index < [objects count] &&
- ![[objects objectAtIndex:view_index] isKindOfClass:[NSView class]])
- ++view_index;
- DCHECK(view_index < [objects count]);
- NSView* accessory_view = [objects objectAtIndex:view_index];
NSPopUpButton* popup = [accessory_view viewWithTag:kFileTypePopupTag];
DCHECK(popup);
« no previous file with comments | « no previous file | content/shell/shell_login_dialog_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698