1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/memory/scoped_ptr.h"
11 #include "ipc/ipc_logging.h"
12 #include "ipc/ipc_message_utils.h"
13 #include "third_party/google_toolbox_for_mac/src/Foundation/GTMRegex.h"
15 // Must be included after IPC_MESSAGE_LOG_ENABLED gets defined
16 #import "chrome/browser/ui/cocoa/about_ipc_dialog.h"
18 #if defined(IPC_MESSAGE_LOG_ENABLED)
20 // An objc wrapper for IPC::LogData to allow use of Cocoa bindings.
21 @interface CocoaLogData
: NSObject
{
25 - (id
)initWithLogData
:(const IPC::LogData
&)data
;
29 // A window controller that handles the about:ipc non-modal dialog.
30 @interface AboutIPCController
: NSWindowController
{
32 scoped_ptr
<AboutIPCBridge
> bridge_
;
33 IBOutlet NSButton
* startStopButton_
;
34 IBOutlet NSTableView
* tableView_
;
35 IBOutlet NSArrayController
* dataController_
;
36 IBOutlet NSTextField
* eventCount_
;
37 IBOutlet NSTextField
* filteredEventCount_
;
38 IBOutlet NSTextField
* userStringTextField1_
;
39 IBOutlet NSTextField
* userStringTextField2_
;
40 IBOutlet NSTextField
* userStringTextField3_
;
41 // Count of filtered events.
42 int filteredEventCounter_
;
43 // Cocoa-bound to check boxes for filtering messages.
44 // Each BOOL allows events that have that name prefix.
45 // E.g. if set, appCache_ allows events named AppCache*.
46 // The actual string to match is defined in the xib.
47 // The userStrings allow a user-specified prefix.
55 BOOL pluginProcessing_
;
61 + (AboutIPCController
*)sharedController
;
63 - (IBAction
)startStop
:(id
)sender
;
64 - (IBAction
)clear
:(id
)sender
;
66 // Called from our C++ bridge class. To accomodate multithreaded
67 // ownership issues, this method ACCEPTS OWNERSHIP of the arg passed
69 - (void)log
:(CocoaLogData
*)data
;
71 // Update visible state (e.g. Start/Stop button) based on logging run
72 // state. Does not change state.
73 - (void)updateVisibleRunState
;
77 @interface
AboutIPCController(TestingAPI
)
78 - (BOOL
)filterOut
:(CocoaLogData
*)data
;
79 - (void)setDisplayViewMessages
:(BOOL
)display
;
82 #endif // IPC_MESSAGE_LOG_ENABLED
83 #endif // CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_