-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnode-webkit-mas.diff
722 lines (655 loc) · 25.7 KB
/
node-webkit-mas.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index e94e24d..0cdfb49 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -36,7 +36,7 @@
// process will be considered as hung for some reason. The second process then
// retrieves the process id from the symbol link and kills it by sending
// SIGKILL. Then the second process starts as normal.
-
+#define MAC_APP_STORE
#include "chrome/browser/process_singleton.h"
#include <errno.h>
@@ -94,6 +94,37 @@ using content::BrowserThread;
namespace {
+// XXX:
+class SanitizedSocketPath {
+ public:
+ explicit SanitizedSocketPath(const base::FilePath& socket_path)
+ : socket_path_(socket_path) {
+ if (socket_path.value().length() >= arraysize(sockaddr_un::sun_path)) {
+ bool found_current_dir = GetCurrentDirectory(&old_path_);
+ CHECK(found_current_dir) << "Failed to determine the current directory.";
+ changed_directory_ = SetCurrentDirectory(socket_path.DirName());
+ CHECK(changed_directory_) << "Failed to change directory: " <<
+ socket_path.DirName().value();
+ }
+ }
+
+ ~SanitizedSocketPath() {
+ if (changed_directory_)
+ SetCurrentDirectory(old_path_);
+ }
+
+ base::FilePath SocketPath() const {
+ return changed_directory_ ? socket_path_.BaseName() : socket_path_;
+ }
+
+ private:
+ bool changed_directory_ = false;
+ base::FilePath socket_path_;
+ base::FilePath old_path_;
+
+ DISALLOW_COPY_AND_ASSIGN(SanitizedSocketPath);
+};
+
// Timeout for the current browser process to respond. 20 seconds should be
// enough.
const int kTimeoutInSeconds = 20;
@@ -389,13 +420,16 @@ bool ConnectSocket(ScopedSocket* socket,
return false;
// Now we know the directory was (at that point) created by the profile
// owner. Try to connect.
- sockaddr_un addr;
- SetupSockAddr(socket_target.value(), &addr);
- int ret = HANDLE_EINTR(connect(socket->fd(),
- reinterpret_cast<sockaddr*>(&addr),
- sizeof(addr)));
- if (ret != 0)
- return false;
+ {
+ SanitizedSocketPath sanitized_socket_target(socket_target);
+ sockaddr_un addr;
+ SetupSockAddr(sanitized_socket_target.SocketPath().value(), &addr);
+ int ret = HANDLE_EINTR(connect(socket->fd(),
+ reinterpret_cast<sockaddr*>(&addr),
+ sizeof(addr)));
+ if (ret != 0)
+ return false;
+ }
// Check the cookie again. We only link in /tmp, which is sticky, so, if the
// directory is still correct, it must have been correct in-between when we
// connected. POSIX, sadly, lacks a connectat().
@@ -408,8 +442,9 @@ bool ConnectSocket(ScopedSocket* socket,
} else if (errno == EINVAL) {
// It exists, but is not a symlink (or some other error we detect
// later). Just connect to it directly; this is an older version of Chrome.
+ SanitizedSocketPath sanitized_socket_path(socket_path);
sockaddr_un addr;
- SetupSockAddr(socket_path.value(), &addr);
+ SetupSockAddr(sanitized_socket_path.SocketPath().value(), &addr);
int ret = HANDLE_EINTR(connect(socket->fd(),
reinterpret_cast<sockaddr*>(&addr),
sizeof(addr)));
@@ -986,14 +1021,19 @@ bool ProcessSingleton::Create() {
<< "Temp directory mode is not 700: " << std::oct << dir_mode;
// Setup the socket symlink and the two cookies.
+ #ifndef MAC_APP_STORE
base::FilePath socket_target_path =
socket_dir_.path().Append(chrome::kSingletonSocketFilename);
+ #endif
base::FilePath cookie(GenerateCookie());
base::FilePath remote_cookie_path =
socket_dir_.path().Append(chrome::kSingletonCookieFilename);
UnlinkPath(socket_path_);
UnlinkPath(cookie_path_);
- if (!SymlinkPath(socket_target_path, socket_path_) ||
+ if (
+#ifndef MAC_APP_STORE
+ !SymlinkPath(socket_target_path, socket_path_) ||
+#endif
!SymlinkPath(cookie, cookie_path_) ||
!SymlinkPath(cookie, remote_cookie_path)) {
// We've already locked things, so we can't have lost the startup race,
@@ -1004,10 +1044,19 @@ bool ProcessSingleton::Create() {
return false;
}
- SetupSocket(socket_target_path.value(), &sock, &addr);
+#ifndef MAC_APP_STORE
+ SanitizedSocketPath sanitized_socket_target(socket_target_path);
+#else
+ SanitizedSocketPath sanitized_socket_target(socket_path_);
+#endif
+ SetupSocket(sanitized_socket_target.SocketPath().value(), &sock, &addr);
if (bind(sock, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) < 0) {
+#ifndef MAC_APP_STORE
PLOG(ERROR) << "Failed to bind() " << socket_target_path.value();
+#else
+ PLOG(ERROR) << "Failed to bind() " << socket_path_.value();
+#endif
CloseSocket(sock);
return false;
}
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index aa08394..7dd882a 100644
--- a/chrome/common/chrome_constants.cc
+++ b/chrome/common/chrome_constants.cc
@@ -7,6 +7,7 @@
#include "base/files/file_path.h"
#define FPL FILE_PATH_LITERAL
+#define MAC_APP_STORE
#if defined(OS_MACOSX)
#define CHROMIUM_PRODUCT_STRING "Chromium"
@@ -171,8 +172,18 @@ const base::FilePath::CharType kShortcutsDatabaseName[] = FPL("Shortcuts");
const base::FilePath::CharType kSingletonCookieFilename[] =
FPL("SingletonCookie");
const base::FilePath::CharType kSingletonLockFilename[] = FPL("SingletonLock");
-const base::FilePath::CharType kSingletonSocketFilename[] =
- FPL("SingletonSocket");
+#ifdef MAC_APP_STORE
+// Used to be SingletonSocket but due to length limits of sockets we must peal this down.
+// See: https://code.google.com/p/chromium/issues/detail?id=33097 this is a temporary
+// work around.
+//
+// See: https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man4/unix.4.html
+ const base::FilePath::CharType kSingletonSocketFilename[] =
+ FPL("S");
+#else
+ const base::FilePath::CharType kSingletonSocketFilename[] =
+ FPL("SingletonSocket");
+#endif
const base::FilePath::CharType kSupervisedUserSettingsFilename[] =
FPL("Managed Mode Settings");
const base::FilePath::CharType kSyncCredentialsFilename[] =
diff --git a/content/browser/accessibility/browser_accessibility_cocoa.mm b/content/browser/accessibility/browser_accessibility_cocoa.mm
index f9de080..772ef21 100644
--- a/content/browser/accessibility/browser_accessibility_cocoa.mm
+++ b/content/browser/accessibility/browser_accessibility_cocoa.mm
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include <execinfo.h>
-
+#define MAC_APP_STORE
#import "content/browser/accessibility/browser_accessibility_cocoa.h"
#include <map>
@@ -18,10 +18,12 @@
#include "content/public/common/content_client.h"
#import "ui/accessibility/platform/ax_platform_node_mac.h"
-// See http://openradar.appspot.com/9896491. This SPI has been tested on 10.5,
-// 10.6, and 10.7. It allows accessibility clients to observe events posted on
-// this object.
-extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element);
+#ifndef MAC_APP_STORE
+ // See http://openradar.appspot.com/9896491. This SPI has been tested on 10.5,
+ // 10.6, and 10.7. It allows accessibility clients to observe events posted on
+ // this object.
+ extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element);
+#endif
using ui::AXNodeData;
using content::BrowserAccessibility;
@@ -136,7 +138,9 @@ NSDictionary* attributeToMethodNameMap = nil;
- (void)detach {
if (browserAccessibility_) {
- NSAccessibilityUnregisterUniqueIdForUIElement(self);
+#ifndef MAC_APP_STORE
+ NSAccessibilityUnregisterUniqueIdForUIElement(self);
+#endif
browserAccessibility_ = NULL;
}
}
diff --git a/content/browser/device_monitor_mac.mm b/content/browser/device_monitor_mac.mm
index f33c097..a05ecdc 100644
--- a/content/browser/device_monitor_mac.mm
+++ b/content/browser/device_monitor_mac.mm
@@ -3,8 +3,11 @@
// found in the LICENSE file.
#include "content/browser/device_monitor_mac.h"
-
-#import <QTKit/QTKit.h>
+#define MAC_APP_STORE
+#ifndef MAC_APP_STORE
+ #import <QTKit/QTKit.h>
+#endif
+#import <Foundation/Foundation.h>
#include <set>
@@ -149,6 +152,7 @@ class QTKitMonitorImpl : public DeviceMonitorMacImpl {
QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor)
: DeviceMonitorMacImpl(monitor) {
+#ifndef MAC_APP_STORE
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
device_arrival_ =
[nc addObserverForName:QTCaptureDeviceWasConnectedNotification
@@ -168,25 +172,31 @@ QTKitMonitorImpl::QTKitMonitorImpl(content::DeviceMonitorMac* monitor)
queue:nil
usingBlock:^(NSNotification* notification) {
OnAttributeChanged(notification);}];
+#endif
}
QTKitMonitorImpl::~QTKitMonitorImpl() {
+#ifndef MAC_APP_STORE
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:device_arrival_];
[nc removeObserver:device_removal_];
[nc removeObserver:device_change_];
+#endif
}
void QTKitMonitorImpl::OnAttributeChanged(
NSNotification* notification) {
+#ifndef MAC_APP_STORE
if ([[[notification userInfo]
objectForKey:QTCaptureDeviceChangedAttributeKey]
isEqualToString:QTCaptureDeviceSuspendedAttribute]) {
OnDeviceChanged();
}
+#endif
}
void QTKitMonitorImpl::OnDeviceChanged() {
+#ifndef MAC_APP_STORE
std::vector<DeviceInfo> snapshot_devices;
NSArray* devices = [QTCaptureDevice inputDevices];
@@ -211,6 +221,7 @@ void QTKitMonitorImpl::OnDeviceChanged() {
DeviceInfo([[device uniqueID] UTF8String], device_type));
}
ConsolidateDevicesListAndNotify(snapshot_devices);
+#endif
}
// Forward declaration for use by CrAVFoundationDeviceObserver.
@@ -532,7 +543,9 @@ void DeviceMonitorMac::StartMonitoring(
device_task_runner));
} else {
DVLOG(1) << "Monitoring via QTKit";
+#ifndef MAC_APP_STORE
device_monitor_impl_.reset(new QTKitMonitorImpl(this));
+#endif
}
}
@@ -540,7 +553,9 @@ void DeviceMonitorMac::NotifyDeviceChanged(
base::SystemMonitor::DeviceType type) {
DCHECK(thread_checker_.CalledOnValidThread());
// TODO(xians): Remove the global variable for SystemMonitor.
- base::SystemMonitor::Get()->ProcessDevicesChanged(type);
+#ifndef MAC_APP_STORE
+ base::SystemMonitor::Get()->ProcessDevicesChanged(type);
+#endif
}
} // namespace content
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 160a986..b95e29f 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -1,7 +1,7 @@
// 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.
-
+#define MAC_APP_STORE
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#import <objc/runtime.h>
@@ -2891,9 +2891,11 @@ static const NSTrackingRectTag kTrackingRectTag = 0xBADFACE;
// Since this implementation doesn't have to wait any IPC calls, this doesn't
// make any key-typing jank. --hbono 7/23/09
//
-extern "C" {
-extern NSString *NSTextInputReplacementRangeAttributeName;
-}
+#ifndef MAC_APP_STORE
+ extern "C" {
+ extern NSString *NSTextInputReplacementRangeAttributeName;
+ }
+#endif
- (NSArray *)validAttributesForMarkedText {
// This code is just copied from WebKit except renaming variables.
@@ -2902,7 +2904,9 @@ extern NSString *NSTextInputReplacementRangeAttributeName;
NSUnderlineStyleAttributeName,
NSUnderlineColorAttributeName,
NSMarkedClauseSegmentAttributeName,
+#ifndef MAC_APP_STORE
NSTextInputReplacementRangeAttributeName,
+#endif
nil]);
}
return validAttributesForMarkedText_.get();
diff --git a/content/common/sandbox_mac.mm b/content/common/sandbox_mac.mm
index 590aa85..341c82b 100644
--- a/content/common/sandbox_mac.mm
+++ b/content/common/sandbox_mac.mm
@@ -40,9 +40,13 @@ extern "C" {
#include "ui/base/layout.h"
#include "ui/gl/gl_surface.h"
+#define MAC_APP_STORE
+
extern "C" {
-void CGSSetDenyWindowServerConnections(bool);
-void CGSShutdownServerConnections();
+#ifndef MAC_APP_STORE
+ void CGSSetDenyWindowServerConnections(bool);
+ void CGSShutdownServerConnections();
+#endif
};
namespace content {
@@ -344,8 +348,10 @@ void Sandbox::SandboxWarmup(int sandbox_type) {
// 10.8 and higher because doing it on earlier OSes causes layout tests to
// fail <http://crbug.com/397642#c48>. This may cause two log messages to
// be printed to the system logger on certain OS versions.
- CGSSetDenyWindowServerConnections(true);
- CGSShutdownServerConnections();
+ #ifndef MAC_APP_STORE
+ CGSSetDenyWindowServerConnections(true);
+ CGSShutdownServerConnections();
+ #endif
}
}
diff --git a/media/media.gyp b/media/media.gyp
index 05fc131..668e140 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -942,7 +942,6 @@
'$(SDKROOT)/System/Library/Frameworks/CoreMIDI.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreVideo.framework',
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
- '$(SDKROOT)/System/Library/Frameworks/QTKit.framework',
],
},
}],
diff --git a/media/video/capture/mac/video_capture_device_factory_mac.mm b/media/video/capture/mac/video_capture_device_factory_mac.mm
index 3650a06..d2b4103 100644
--- a/media/video/capture/mac/video_capture_device_factory_mac.mm
+++ b/media/video/capture/mac/video_capture_device_factory_mac.mm
@@ -1,7 +1,7 @@
// 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.
-
+#define MAC_APP_STORE
#include "media/video/capture/mac/video_capture_device_factory_mac.h"
#import <IOKit/audio/IOAudioTypes.h>
@@ -44,6 +44,7 @@ static bool IsDeviceBlacklisted(const VideoCaptureDevice::Name& name) {
static scoped_ptr<media::VideoCaptureDevice::Names>
EnumerateDevicesUsingQTKit() {
+#ifndef MAC_APP_STORE
scoped_ptr<VideoCaptureDevice::Names> device_names(
new VideoCaptureDevice::Names());
NSMutableDictionary* capture_devices =
@@ -58,6 +59,9 @@ EnumerateDevicesUsingQTKit() {
device_names->push_back(name);
}
return device_names.Pass();
+#else
+ return scoped_ptr<media::VideoCaptureDevice::Names>();
+#endif
}
static void RunDevicesEnumeratedCallback(
@@ -82,6 +86,7 @@ VideoCaptureDeviceFactoryMac::~VideoCaptureDeviceFactoryMac() {}
scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryMac::Create(
const VideoCaptureDevice::Name& device_name) {
+#ifndef MAC_APP_STORE
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_NE(device_name.capture_api_type(),
VideoCaptureDevice::Name::API_TYPE_UNKNOWN);
@@ -115,10 +120,14 @@ scoped_ptr<VideoCaptureDevice> VideoCaptureDeviceFactoryMac::Create(
}
}
return scoped_ptr<VideoCaptureDevice>(capture_device.Pass());
+#else
+ return scoped_ptr<VideoCaptureDevice>();
+#endif
}
void VideoCaptureDeviceFactoryMac::GetDeviceNames(
VideoCaptureDevice::Names* device_names) {
+#ifndef MAC_APP_STORE
DCHECK(thread_checker_.CalledOnValidThread());
// Loop through all available devices and add to |device_names|.
NSDictionary* capture_devices;
@@ -149,6 +158,7 @@ void VideoCaptureDeviceFactoryMac::GetDeviceNames(
// We should not enumerate QTKit devices in Device Thread;
NOTREACHED();
}
+#endif
}
void VideoCaptureDeviceFactoryMac::EnumerateDeviceNames(const base::Callback<
diff --git a/media/video/capture/mac/video_capture_device_mac.h b/media/video/capture/mac/video_capture_device_mac.h
index a3fd1b1..af16bdf 100644
--- a/media/video/capture/mac/video_capture_device_mac.h
+++ b/media/video/capture/mac/video_capture_device_mac.h
@@ -6,7 +6,7 @@
// AVFoundation as native capture API. QTKit is available in all OSX versions,
// although namely deprecated in 10.9, and AVFoundation is available in versions
// 10.7 (Lion) and later.
-
+#define MAC_APP_STORE
#ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
#define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_MAC_H_
@@ -21,7 +21,9 @@
#include "media/video/capture/video_capture_device.h"
#include "media/video/capture/video_capture_types.h"
+#ifndef MAC_APP_STORE
@protocol PlatformVideoCapturingMac;
+#endif
namespace base {
class SingleThreadTaskRunner;
@@ -104,9 +106,9 @@ class VideoCaptureDeviceMac : public VideoCaptureDevice {
// Only read and write state_ from inside this loop.
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
InternalState state_;
-
+#ifndef MAC_APP_STORE
id<PlatformVideoCapturingMac> capture_device_;
-
+#endif
// Used with Bind and PostTask to ensure that methods aren't called after the
// VideoCaptureDeviceMac is destroyed.
// NOTE: Weak pointers must be invalidated before all other member variables.
diff --git a/media/video/capture/mac/video_capture_device_mac.mm b/media/video/capture/mac/video_capture_device_mac.mm
index 8e64119..4de477b 100644
--- a/media/video/capture/mac/video_capture_device_mac.mm
+++ b/media/video/capture/mac/video_capture_device_mac.mm
@@ -1,7 +1,7 @@
// 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.
-
+#define MAC_APP_STORE
#include "media/video/capture/mac/video_capture_device_mac.h"
#include <IOKit/IOCFPlugIn.h>
@@ -19,7 +19,9 @@
#import "media/base/mac/avfoundation_glue.h"
#import "media/video/capture/mac/platform_video_capturing_mac.h"
#import "media/video/capture/mac/video_capture_device_avfoundation_mac.h"
-#import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
+#ifndef MAC_APP_STORE
+ #import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
+#endif
#include "ui/gfx/geometry/size.h"
@implementation DeviceNameAndTransportType
@@ -324,6 +326,7 @@ static void SetAntiFlickerInUsbDevice(const int vendor_id,
}
const std::string VideoCaptureDevice::Name::GetModel() const {
+#ifndef MAC_APP_STORE
// Skip the AVFoundation's not USB nor built-in devices.
if (capture_api_type() == AVFOUNDATION && transport_type() != USB_OR_BUILT_IN)
return "";
@@ -340,6 +343,9 @@ const std::string VideoCaptureDevice::Name::GetModel() const {
std::string id_product = unique_id_.substr(pid_location, kVidPidSize);
return id_vendor + ":" + id_product;
+#else
+ return "";
+#endif
}
VideoCaptureDeviceMac::VideoCaptureDeviceMac(const Name& device_name)
@@ -347,7 +353,9 @@ VideoCaptureDeviceMac::VideoCaptureDeviceMac(const Name& device_name)
tried_to_square_pixels_(false),
task_runner_(base::MessageLoopProxy::current()),
state_(kNotInitialized),
+#ifndef MAC_APP_STORE
capture_device_(nil),
+#endif
weak_factory_(this) {
// Avoid reconfiguring AVFoundation or blacklisted devices.
final_resolution_selected_ = AVFoundationGlue::IsAVFoundationSupported() ||
@@ -355,13 +363,16 @@ VideoCaptureDeviceMac::VideoCaptureDeviceMac(const Name& device_name)
}
VideoCaptureDeviceMac::~VideoCaptureDeviceMac() {
+#ifndef MAC_APP_STORE
DCHECK(task_runner_->BelongsToCurrentThread());
[capture_device_ release];
+#endif
}
void VideoCaptureDeviceMac::AllocateAndStart(
const VideoCaptureParams& params,
scoped_ptr<VideoCaptureDevice::Client> client) {
+#ifndef MAC_APP_STORE
DCHECK(task_runner_->BelongsToCurrentThread());
if (state_ != kIdle) {
return;
@@ -429,9 +440,11 @@ void VideoCaptureDeviceMac::AllocateAndStart(
}
state_ = kCapturing;
+#endif
}
void VideoCaptureDeviceMac::StopAndDeAllocate() {
+#ifndef MAC_APP_STORE
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK(state_ == kCapturing || state_ == kError) << state_;
@@ -440,17 +453,20 @@ void VideoCaptureDeviceMac::StopAndDeAllocate() {
client_.reset();
state_ = kIdle;
tried_to_square_pixels_ = false;
+#endif
}
bool VideoCaptureDeviceMac::Init(
VideoCaptureDevice::Name::CaptureApiType capture_api_type) {
+#ifndef MAC_APP_STORE
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, kNotInitialized);
if (capture_api_type == Name::AVFOUNDATION) {
capture_device_ =
[[VideoCaptureDeviceAVFoundation alloc] initWithFrameReceiver:this];
- } else {
+ }
+ else {
capture_device_ =
[[VideoCaptureDeviceQTKit alloc] initWithFrameReceiver:this];
}
@@ -460,6 +476,7 @@ bool VideoCaptureDeviceMac::Init(
state_ = kIdle;
return true;
+#endif
}
void VideoCaptureDeviceMac::ReceiveFrame(
@@ -468,6 +485,7 @@ void VideoCaptureDeviceMac::ReceiveFrame(
const VideoCaptureFormat& frame_format,
int aspect_numerator,
int aspect_denominator) {
+#ifndef MAC_APP_STORE
// This method is safe to call from a device capture thread, i.e. any thread
// controlled by QTKit/AVFoundation.
if (!final_resolution_selected_) {
@@ -542,19 +560,24 @@ void VideoCaptureDeviceMac::ReceiveFrame(
capture_format_,
0,
base::TimeTicks::Now());
+#endif
}
void VideoCaptureDeviceMac::ReceiveError(const std::string& reason) {
+#ifndef MAC_APP_STORE
task_runner_->PostTask(FROM_HERE,
base::Bind(&VideoCaptureDeviceMac::SetErrorState,
weak_factory_.GetWeakPtr(),
reason));
+#endif
}
void VideoCaptureDeviceMac::SetErrorState(const std::string& reason) {
+#ifndef MAC_APP_STORE
DCHECK(task_runner_->BelongsToCurrentThread());
state_ = kError;
client_->OnError(reason);
+#endif
}
void VideoCaptureDeviceMac::LogMessage(const std::string& message) {
@@ -564,6 +587,7 @@ void VideoCaptureDeviceMac::LogMessage(const std::string& message) {
}
bool VideoCaptureDeviceMac::UpdateCaptureResolution() {
+ #ifndef MAC_APP_STORE
if (![capture_device_ setCaptureHeight:capture_format_.frame_size.height()
width:capture_format_.frame_size.width()
frameRate:capture_format_.frame_rate]) {
@@ -571,6 +595,7 @@ bool VideoCaptureDeviceMac::UpdateCaptureResolution() {
return false;
}
return true;
+ #endif
}
} // namespace media
diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.h b/media/video/capture/mac/video_capture_device_qtkit_mac.h
index c1af697..d1937f6 100644
--- a/media/video/capture/mac/video_capture_device_qtkit_mac.h
+++ b/media/video/capture/mac/video_capture_device_qtkit_mac.h
@@ -4,7 +4,8 @@
// VideoCaptureDeviceQTKit implements all QTKit related code for
// communicating with a QTKit capture device.
-
+#define MAC_APP_STORE
+#ifndef MAC_APP_STORE
#ifndef MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_QTKIT_MAC_H_
#define MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_QTKIT_MAC_H_
@@ -74,3 +75,4 @@ class VideoCaptureDeviceMac;
@end
#endif // MEDIA_VIDEO_CAPTURE_MAC_VIDEO_CAPTURE_DEVICE_QTKIT_MAC_H_
+#endif // MAC_APP_STORE
diff --git a/media/video/capture/mac/video_capture_device_qtkit_mac.mm b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
index 126439e..f4fba9c 100644
--- a/media/video/capture/mac/video_capture_device_qtkit_mac.mm
+++ b/media/video/capture/mac/video_capture_device_qtkit_mac.mm
@@ -1,7 +1,8 @@
// 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.
-
+#define MAC_APP_STORE
+#ifndef MAC_APP_STORE
#import "media/video/capture/mac/video_capture_device_qtkit_mac.h"
#import <QTKit/QTKit.h>
@@ -355,3 +356,4 @@
}
@end
+#endif // MAC_APP_STORE
diff --git a/net/dns/dns_config_service_posix.cc b/net/dns/dns_config_service_posix.cc
index 6b79f9c..edbde22 100644
--- a/net/dns/dns_config_service_posix.cc
+++ b/net/dns/dns_config_service_posix.cc
@@ -1,7 +1,7 @@
// 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.
-
+#define MAC_APP_STORE
#include "net/dns/dns_config_service_posix.h"
#include <string>
@@ -208,6 +208,10 @@ class DnsConfigServicePosix::Watcher {
bool Watch() {
bool success = true;
+#ifndef MAC_APP_STORE
+ // this is disabled for acceptance to the mac app store,
+ // entitlements do not allow watching sensitive file system
+ // data in /etc/
if (!config_watcher_.Watch(base::Bind(&Watcher::OnConfigChanged,
base::Unretained(this)))) {
LOG(ERROR) << "DNS config watch failed to start.";
@@ -225,6 +229,7 @@ class DnsConfigServicePosix::Watcher {
DNS_CONFIG_WATCH_FAILED_TO_START_HOSTS,
DNS_CONFIG_WATCH_MAX);
}
+#endif
return success;
}
diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm
index 2f09a36..9c90d80 100644
--- a/ui/shell_dialogs/select_file_dialog_mac.mm
+++ b/ui/shell_dialogs/select_file_dialog_mac.mm
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "ui/shell_dialogs/select_file_dialog.h"
-
+#define MAC_APP_STORE
#import <Cocoa/Cocoa.h>
#include <CoreServices/CoreServices.h>
@@ -402,7 +402,9 @@ bool SelectFileDialogImpl::HasMultipleFileTypeChoicesImpl() {
index = 1;
}
} else {
+ #ifndef MAC_APP_STORE
CHECK([panel isKindOfClass:[NSOpenPanel class]]);
+ #endif
NSArray* urls = [static_cast<NSOpenPanel*>(panel) URLs];
for (NSURL* url in urls)
if ([url isFileURL])