summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/about_ipc_dialog.mm
blob: efb932e9b8cae964a0f6fbffdc9818789093a306 (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
// 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.

#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/cocoa/about_ipc_controller.h"
#include "chrome/browser/ui/cocoa/about_ipc_dialog.h"

#if defined(IPC_MESSAGE_LOG_ENABLED)

namespace chrome {

void ShowAboutIPCDialog() {
  // The controller gets deallocated when then window is closed,
  // so it is safe to "fire and forget".
  AboutIPCController* controller = [AboutIPCController sharedController];
  [[controller window] makeKeyAndOrderFront:controller];
}

}  // namespace chrome

void AboutIPCBridge::Log(const IPC::LogData& data) {
  CocoaLogData* cocoa_data = [[CocoaLogData alloc] initWithLogData:data];
  if ([NSThread isMainThread]) {
    [controller_ log:cocoa_data];
  } else {
    [controller_ performSelectorOnMainThread:@selector(log:)
                                  withObject:cocoa_data
                               waitUntilDone:NO];
  }
}

#endif  // IPC_MESSAGE_LOG_ENABLED