• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

google / santa / 9976147425

17 Jul 2024 02:29PM UTC coverage: 63.269% (+0.08%) from 63.19%
9976147425

push

github

web-flow
GUI: Update activation policy for binary blocks (#1396)

Also fix threading issues with the `queueMessage:` method.

5656 of 13396 branches covered (42.22%)

Branch coverage included in aggregate %.

13 of 25 new or added lines in 1 file covered. (52.0%)

4 existing lines in 2 files now uncovered.

18836 of 25315 relevant lines covered (74.41%)

6012.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Source/gui/SNTFileAccessMessageWindowController.m
1
/// Copyright 2023 Google LLC
2
///
3
/// Licensed under the Apache License, Version 2.0 (the "License");
4
/// you may not use this file except in compliance with the License.
5
/// You may obtain a copy of the License at
6
///
7
///     https://www.apache.org/licenses/LICENSE-2.0
8
///
9
/// Unless required by applicable law or agreed to in writing, software
10
/// distributed under the License is distributed on an "AS IS" BASIS,
11
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
/// See the License for the specific language governing permissions and
13
/// limitations under the License.
14

15
#import "Source/gui/SNTFileAccessMessageWindowController.h"
16
#import "Source/gui/SNTFileAccessMessageWindowView-Swift.h"
17

18
#import "Source/common/SNTBlockMessage.h"
19
#import "Source/common/SNTFileAccessEvent.h"
20
#import "Source/common/SNTLogging.h"
21

22
@interface SNTFileAccessMessageWindowController ()
23
@property NSString *customMessage;
24
@property NSString *customURL;
25
@property NSString *customText;
26
@property SNTFileAccessEvent *event;
27
@end
28

29
@implementation SNTFileAccessMessageWindowController
30

31
- (instancetype)initWithEvent:(SNTFileAccessEvent *)event
32
                customMessage:(nullable NSString *)message
33
                    customURL:(nullable NSString *)url
34
                   customText:(nullable NSString *)text {
×
35
  self = [super init];
×
36
  if (self) {
×
37
    _event = event;
×
38
    _customMessage = message;
×
39
    _customURL = url;
×
40
    _customText = text;
×
41
  }
×
42
  return self;
×
43
}
×
44

45
- (void)showWindow:(id)sender {
×
46
  if (self.window) {
×
47
    [self.window orderOut:sender];
×
48
  }
×
49

50
  self.window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 0, 0)
×
51
                                            styleMask:NSWindowStyleMaskBorderless
×
52
                                              backing:NSBackingStoreBuffered
×
53
                                                defer:NO];
×
54

55
  self.window.contentViewController = [SNTFileAccessMessageWindowViewFactory
×
56
    createWithWindow:self.window
×
57
               event:self.event
×
58
       customMessage:self.attributedCustomMessage
×
59
           customURL:[SNTBlockMessage eventDetailURLForFileAccessEvent:self.event
×
60
                                                             customURL:self.customURL]
×
61
                       .absoluteString
×
62
          customText:self.customText
×
63
     uiStateCallback:^(BOOL preventNotificationsForADay) {
×
64
       self.silenceFutureNotifications = preventNotificationsForADay;
×
65
     }];
×
66

67
  self.window.delegate = self;
×
68

UNCOV
69
  [super showWindow:sender];
×
70
}
×
71

72
- (NSAttributedString *)attributedCustomMessage {
×
UNCOV
73
  return [SNTBlockMessage attributedBlockMessageForFileAccessEvent:self.event
×
74
                                                     customMessage:self.customMessage];
×
75
}
×
76

77
- (NSString *)messageHash {
×
78
  // The hash for display de-duplication/silencing purposes is a combination of:
79
  // 1. The current file access rule version
80
  // 2. The name of the rule that was violated
81
  // 3. The path of the process
82
  return [NSString
×
83
    stringWithFormat:@"%@|%@|%@", self.event.ruleVersion, self.event.ruleName, self.event.filePath];
×
84
}
×
85

86
@end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc