summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/about_ipc_controller.h
blob: c6e8dc0a6e668352345246b113e2968de4886c5f (plain)
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
// Copyright (c) 2009 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 CHROME_BROWSER_COCOA_ABOUT_IPC_CONTROLLER_H_
#define CHROME_BROWSER_COCOA_ABOUT_IPC_CONTROLLER_H_
#pragma once

#import <Cocoa/Cocoa.h>

#include "base/scoped_ptr.h"
#include "ipc/ipc_logging.h"
#include "ipc/ipc_message_utils.h"
#include "third_party/GTM/Foundation/GTMRegex.h"

// Must be included after IPC_MESSAGE_LOG_ENABLED gets defined
#import "chrome/browser/cocoa/about_ipc_bridge.h"

#if defined(IPC_MESSAGE_LOG_ENABLED)

// An objc wrapper for IPC::LogData to allow use of Cocoa bindings.
@interface CocoaLogData : NSObject {
 @private
  IPC::LogData data_;
}
- (id)initWithLogData:(const IPC::LogData&)data;
@end


// A window controller that handles the about:ipc non-modal dialog.
@interface AboutIPCController : NSWindowController {
 @private
  scoped_ptr<AboutIPCBridge> bridge_;
  IBOutlet NSButton* startStopButton_;
  IBOutlet NSTableView* tableView_;
  IBOutlet NSArrayController* dataController_;
  IBOutlet NSTextField* eventCount_;
  IBOutlet NSTextField* filteredEventCount_;
  IBOutlet NSTextField* userStringTextField1_;
  IBOutlet NSTextField* userStringTextField2_;
  IBOutlet NSTextField* userStringTextField3_;
  // Count of filtered events.
  int filteredEventCounter_;
  // Cocoa-bound to check boxes for filtering messages.
  // Each BOOL allows events that have that name prefix.
  // E.g. if set, appCache_ allows events named AppCache*.
  // The actual string to match is defined in the xib.
  // The userStrings allow a user-specified prefix.
  BOOL appCache_;
  BOOL view_;
  BOOL utilityHost_;
  BOOL viewHost_;
  BOOL plugin_;
  BOOL npObject_;
  BOOL devTools_;
  BOOL pluginProcessing_;
  BOOL userString1_;
  BOOL userString2_;
  BOOL userString3_;
}

+ (AboutIPCController*)sharedController;

- (IBAction)startStop:(id)sender;
- (IBAction)clear:(id)sender;

// Called from our C++ bridge class.  To accomodate multithreaded
// ownership issues, this method ACCEPTS OWNERSHIP of the arg passed
// in.
- (void)log:(CocoaLogData*)data;

// Update visible state (e.g. Start/Stop button) based on logging run
// state.  Does not change state.
- (void)updateVisibleRunState;

@end

@interface AboutIPCController(TestingAPI)
- (BOOL)filterOut:(CocoaLogData*)data;
- (void)setDisplayViewMessages:(BOOL)display;
@end

#endif  // IPC_MESSAGE_LOG_ENABLED
#endif  // CHROME_BROWSER_COCOA_ABOUT_IPC_CONTROLLER_H_