diff options
-rw-r--r-- | chrome/browser/ui/cocoa/about_ipc_bridge.h | 33 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/about_ipc_bridge.mm | 21 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/about_ipc_controller.h | 2 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/about_ipc_dialog.h | 31 | ||||
-rw-r--r-- | chrome/browser/ui/cocoa/about_ipc_dialog.mm | 15 | ||||
-rw-r--r-- | chrome/chrome_browser.gypi | 2 |
6 files changed, 40 insertions, 64 deletions
diff --git a/chrome/browser/ui/cocoa/about_ipc_bridge.h b/chrome/browser/ui/cocoa/about_ipc_bridge.h deleted file mode 100644 index 77041b3..0000000 --- a/chrome/browser/ui/cocoa/about_ipc_bridge.h +++ /dev/null @@ -1,33 +0,0 @@ -// 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_UI_COCOA_ABOUT_IPC_BRIDGE_H_ -#define CHROME_BROWSER_UI_COCOA_ABOUT_IPC_BRIDGE_H_ -#pragma once - -#include "ipc/ipc_logging.h" -#include "ipc/ipc_message_utils.h" - -#if defined(IPC_MESSAGE_LOG_ENABLED) - -@class AboutIPCController; - -// On Windows, the AboutIPCDialog is a views::View. On Mac we have a -// Cocoa dialog. This class bridges from C++ to ObjC. -class AboutIPCBridge : public IPC::Logging::Consumer { - public: - AboutIPCBridge(AboutIPCController* controller) : controller_(controller) { } - virtual ~AboutIPCBridge() { } - - // IPC::Logging::Consumer implementation. - virtual void Log(const IPC::LogData& data); - - private: - AboutIPCController* controller_; // weak; owns me - DISALLOW_COPY_AND_ASSIGN(AboutIPCBridge); -}; - -#endif // IPC_MESSAGE_LOG_ENABLED - -#endif // CHROME_BROWSER_UI_COCOA_ABOUT_IPC_BRIDGE_H_ diff --git a/chrome/browser/ui/cocoa/about_ipc_bridge.mm b/chrome/browser/ui/cocoa/about_ipc_bridge.mm deleted file mode 100644 index 7a7f41f..0000000 --- a/chrome/browser/ui/cocoa/about_ipc_bridge.mm +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -#include "chrome/browser/ui/cocoa/about_ipc_bridge.h" -#include "chrome/browser/ui/cocoa/about_ipc_controller.h" - -#if defined(IPC_MESSAGE_LOG_ENABLED) - -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 diff --git a/chrome/browser/ui/cocoa/about_ipc_controller.h b/chrome/browser/ui/cocoa/about_ipc_controller.h index f0818f9..f0d4075 100644 --- a/chrome/browser/ui/cocoa/about_ipc_controller.h +++ b/chrome/browser/ui/cocoa/about_ipc_controller.h @@ -14,7 +14,7 @@ #include "third_party/GTM/Foundation/GTMRegex.h" // Must be included after IPC_MESSAGE_LOG_ENABLED gets defined -#import "chrome/browser/ui/cocoa/about_ipc_bridge.h" +#import "chrome/browser/ui/cocoa/about_ipc_dialog.h" #if defined(IPC_MESSAGE_LOG_ENABLED) diff --git a/chrome/browser/ui/cocoa/about_ipc_dialog.h b/chrome/browser/ui/cocoa/about_ipc_dialog.h index 3eb2bcd..7755580 100644 --- a/chrome/browser/ui/cocoa/about_ipc_dialog.h +++ b/chrome/browser/ui/cocoa/about_ipc_dialog.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,19 +6,40 @@ #define CHROME_BROWSER_UI_COCOA_ABOUT_IPC_DIALOG_H_ #pragma once -#include "ipc/ipc_message.h" +#include "ipc/ipc_logging.h" +#include "ipc/ipc_message_utils.h" #if defined(IPC_MESSAGE_LOG_ENABLED) +#ifdef __OBJC__ +@class AboutIPCController; +#else +class AboutIPCController; +#endif + namespace AboutIPCDialog { // The dialog is a singleton. If the dialog is already opened, it won't do // anything, so you can just blindly call this function all you want. // RunDialog() is Called from chrome/browser/browser_about_handler.cc // in response to an about:ipc URL. void RunDialog(); -}; +} + +// On Windows, the AboutIPCDialog is a views::View. On Mac we have a +// Cocoa dialog. This class bridges from C++ to ObjC. +class AboutIPCBridge : public IPC::Logging::Consumer { + public: + AboutIPCBridge(AboutIPCController* controller) : controller_(controller) { } + virtual ~AboutIPCBridge() { } + // IPC::Logging::Consumer implementation. + virtual void Log(const IPC::LogData& data); + + private: + AboutIPCController* controller_; // weak; owns me + DISALLOW_COPY_AND_ASSIGN(AboutIPCBridge); +}; -#endif /* IPC_MESSAGE_LOG_ENABLED */ +#endif // IPC_MESSAGE_LOG_ENABLED -#endif /* CHROME_BROWSER_UI_COCOA_ABOUT_IPC_DIALOG_H_ */ +#endif // CHROME_BROWSER_UI_COCOA_ABOUT_IPC_DIALOG_H_ diff --git a/chrome/browser/ui/cocoa/about_ipc_dialog.mm b/chrome/browser/ui/cocoa/about_ipc_dialog.mm index 7715f24..0a398ac 100644 --- a/chrome/browser/ui/cocoa/about_ipc_dialog.mm +++ b/chrome/browser/ui/cocoa/about_ipc_dialog.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -16,6 +16,17 @@ void RunDialog() { [[controller window] makeKeyAndOrderFront:controller]; } -}; // namespace AboutIPCDialog +} // namespace AboutIPCDialog + +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 diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index d51f6b2..bde19ab 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2625,8 +2625,6 @@ 'browser/ui/browser_navigator.cc', 'browser/ui/browser_navigator.h', 'browser/ui/browser_window.h', - 'browser/ui/cocoa/about_ipc_bridge.h', - 'browser/ui/cocoa/about_ipc_bridge.mm', 'browser/ui/cocoa/about_ipc_controller.h', 'browser/ui/cocoa/about_ipc_controller.mm', 'browser/ui/cocoa/about_ipc_dialog.h', |