diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 15:24:53 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 15:24:53 +0000 |
commit | 824ff72c82dd2a95b41c04ff6f26d1ff08823121 (patch) | |
tree | 7843dda69ac848d36ba08de818c2fc8a9c475f89 /base | |
parent | 70b6663b6f6558f0f93e6136426c37879ea7ef74 (diff) | |
download | chromium_src-824ff72c82dd2a95b41c04ff6f26d1ff08823121.zip chromium_src-824ff72c82dd2a95b41c04ff6f26d1ff08823121.tar.gz chromium_src-824ff72c82dd2a95b41c04ff6f26d1ff08823121.tar.bz2 |
[Mac] Use an AppleEvent to tell the Finder to open downloaded items, rather than NSWorkspace.
BUG=32921,50263
TEST=Force a PDF to download. Quit Preview, if open. Open the downloaded PDF from the download shelf. Preview opens and becomes frontmost.
TEST=Download a file of a type that you do not have an application with which to open it. Open it from the download shelf. Finder bounces for your attention to choose an application to open it.
Review URL: http://codereview.chromium.org/3151011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56026 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.gypi | 6 | ||||
-rw-r--r-- | base/scoped_aedesc.h | 47 |
2 files changed, 53 insertions, 0 deletions
diff --git a/base/base.gypi b/base/base.gypi index 62b3de3..a307820 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -184,6 +184,7 @@ 'resource_util.h', 'safe_strerror_posix.cc', 'safe_strerror_posix.h', + 'scoped_aedesc.h', 'scoped_bstr_win.cc', 'scoped_bstr_win.h', 'scoped_callback_factory.h', @@ -331,6 +332,11 @@ ], }, ], + [ 'OS != "mac"', { + 'sources!': [ + 'scoped_aedesc.h' + ], + }], # For now, just test the *BSD platforms enough to exclude them. # Subsequent changes will include them further. [ 'OS != "freebsd"', { diff --git a/base/scoped_aedesc.h b/base/scoped_aedesc.h new file mode 100644 index 0000000..9239887 --- /dev/null +++ b/base/scoped_aedesc.h @@ -0,0 +1,47 @@ +// 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 BASE_SCOPED_AEDESC_H_ +#define BASE_SCOPED_AEDESC_H_ +#pragma once + +#import <CoreServices/CoreServices.h> + +#include "base/basictypes.h" + +// The scoped_aedesc is used to scope AppleEvent descriptors. On creation, +// it will store a NULL descriptor. On destruction, it will dispose of the +// descriptor. +// +// This class is parameterized for additional type safety checks. You can use +// the generic AEDesc type by not providing a template parameter: +// scoped_aedesc<> desc; +template <typename AEDescType = AEDesc> +class scoped_aedesc { + public: + scoped_aedesc() { + AECreateDesc(typeNull, NULL, 0, &desc_); + } + + ~scoped_aedesc() { + AEDisposeDesc(&desc_); + } + + // Used for in parameters. + operator const AEDescType*() { + return &desc_; + } + + // Used for out parameters. + AEDescType* OutPointer() { + return &desc_; + } + + private: + AEDescType desc_; + + DISALLOW_COPY_AND_ASSIGN(scoped_aedesc); +}; + +#endif // BASE_SCOPED_AEDESC_H_ |