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. 4 5 #ifndef CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_ 7 8 #import <Cocoa/Cocoa.h> 9 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" 14 15 // Must be included after IPC_MESSAGE_LOG_ENABLED gets defined 16 #import "chrome/browser/ui/cocoa/about_ipc_dialog.h" 17 18 #if defined(IPC_MESSAGE_LOG_ENABLED) 19 20 // An objc wrapper for IPC::LogData to allow use of Cocoa bindings. 21 @interface CocoaLogData : NSObject { 22 @private 23 IPC::LogData data_; 24 } 25 - (id)initWithLogData:(const IPC::LogData&)data; 26 @end 27 28 29 // A window controller that handles the about:ipc non-modal dialog. 30 @interface AboutIPCController : NSWindowController { 31 @private 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. 48 BOOL appCache_; 49 BOOL view_; 50 BOOL utilityHost_; 51 BOOL viewHost_; 52 BOOL plugin_; 53 BOOL npObject_; 54 BOOL devTools_; 55 BOOL pluginProcessing_; 56 BOOL userString1_; 57 BOOL userString2_; 58 BOOL userString3_; 59 } 60 61 + (AboutIPCController*)sharedController; 62 63 - (IBAction)startStop:(id)sender; 64 - (IBAction)clear:(id)sender; 65 66 // Called from our C++ bridge class. To accomodate multithreaded 67 // ownership issues, this method ACCEPTS OWNERSHIP of the arg passed 68 // in. 69 - (void)log:(CocoaLogData*)data; 70 71 // Update visible state (e.g. Start/Stop button) based on logging run 72 // state. Does not change state. 73 - (void)updateVisibleRunState; 74 75 @end 76 77 @interface AboutIPCController(TestingAPI) 78 - (BOOL)filterOut:(CocoaLogData*)data; 79 - (void)setDisplayViewMessages:(BOOL)display; 80 @end 81 82 #endif // IPC_MESSAGE_LOG_ENABLED 83 #endif // CHROME_BROWSER_UI_COCOA_ABOUT_IPC_CONTROLLER_H_ 84