- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / about_ipc_dialog.mm
1 // Copyright (c) 2012 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 #include "chrome/browser/ui/browser_dialogs.h"
6 #include "chrome/browser/ui/cocoa/about_ipc_controller.h"
7 #include "chrome/browser/ui/cocoa/about_ipc_dialog.h"
8
9 #if defined(IPC_MESSAGE_LOG_ENABLED)
10
11 namespace chrome {
12
13 void ShowAboutIPCDialog() {
14   // The controller gets deallocated when then window is closed,
15   // so it is safe to "fire and forget".
16   AboutIPCController* controller = [AboutIPCController sharedController];
17   [[controller window] makeKeyAndOrderFront:controller];
18 }
19
20 }  // namespace chrome
21
22 void AboutIPCBridge::Log(const IPC::LogData& data) {
23   CocoaLogData* cocoa_data = [[CocoaLogData alloc] initWithLogData:data];
24   if ([NSThread isMainThread]) {
25     [controller_ log:cocoa_data];
26   } else {
27     [controller_ performSelectorOnMainThread:@selector(log:)
28                                   withObject:cocoa_data
29                                waitUntilDone:NO];
30   }
31 }
32
33 #endif  // IPC_MESSAGE_LOG_ENABLED