diff options
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 3 | ||||
-rw-r--r-- | ash/shell/shell_main.cc | 6 | ||||
-rw-r--r-- | ash/shell/shell_main_parts.cc | 21 | ||||
-rw-r--r-- | ash/shell/shell_main_parts.h | 18 | ||||
-rw-r--r-- | ash/shell/shell_main_parts_mac.mm | 30 |
5 files changed, 74 insertions, 4 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 5e7a95a..d506cf1 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -268,6 +268,9 @@ 'shell/example_factory.h', 'shell/lock_view.cc', 'shell/shell_main.cc', + 'shell/shell_main_parts.h', + 'shell/shell_main_parts.cc', + 'shell/shell_main_parts_mac.mm', 'shell/toplevel_window.cc', 'shell/toplevel_window.h', 'shell/widgets.cc', diff --git a/ash/shell/shell_main.cc b/ash/shell/shell_main.cc index 2276fb5..59a5cd0 100644 --- a/ash/shell/shell_main.cc +++ b/ash/shell/shell_main.cc @@ -8,11 +8,11 @@ #include "ash/shell_factory.h" #include "ash/shell_window_ids.h" #include "ash/shell/example_factory.h" +#include "ash/shell/shell_main_parts.h" #include "ash/shell/toplevel_window.h" #include "ash/wm/window_util.h" #include "base/at_exit.h" #include "base/command_line.h" -#include "base/i18n/icu_util.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "ui/aura/root_window.h" @@ -110,9 +110,7 @@ int main(int argc, char** argv) { // The exit manager is in charge of calling the dtors of singleton objects. base::AtExitManager exit_manager; - ui::RegisterPathProvider(); - icu_util::Initialize(); - ResourceBundle::InitSharedInstance("en-US"); + ash::shell::PreMainMessageLoopStart(); // Create the message-loop here before creating the root window. MessageLoop message_loop(MessageLoop::TYPE_UI); diff --git a/ash/shell/shell_main_parts.cc b/ash/shell/shell_main_parts.cc new file mode 100644 index 0000000..e7b3a0a --- /dev/null +++ b/ash/shell/shell_main_parts.cc @@ -0,0 +1,21 @@ +// 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 "ash/shell/shell_main_parts.h" + +#include "base/i18n/icu_util.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +namespace ash { +namespace shell { + +void PreMainMessageLoopStart() { + ui::RegisterPathProvider(); + icu_util::Initialize(); + ResourceBundle::InitSharedInstance("en-US"); +} + +} // namespace ash +} // namespace shell diff --git a/ash/shell/shell_main_parts.h b/ash/shell/shell_main_parts.h new file mode 100644 index 0000000..46833ec --- /dev/null +++ b/ash/shell/shell_main_parts.h @@ -0,0 +1,18 @@ +// 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. + +#ifndef ASH_SHELL_SHELL_MAIN_PARTS_H_ +#define ASH_SHELL_SHELL_MAIN_PARTS_H_ +#pragma once + +namespace ash { +namespace shell { + +// Platform initializations prior to the start of the main message loop. +void PreMainMessageLoopStart(); + +} // namespace shell +} // namespace ash + +#endif // ASH_SHELL_SHELL_MAIN_PARTS_H_ diff --git a/ash/shell/shell_main_parts_mac.mm b/ash/shell/shell_main_parts_mac.mm new file mode 100644 index 0000000..238ffe5 --- /dev/null +++ b/ash/shell/shell_main_parts_mac.mm @@ -0,0 +1,30 @@ +// 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 "ash/shell/shell_main_parts.h" + +#import <Cocoa/Cocoa.h> + +#include "base/i18n/icu_util.h" +#include "base/mac/mac_util.h" +#include "base/memory/scoped_nsobject.h" +#include "ui/base/resource/resource_bundle.h" +#include "ui/base/ui_base_paths.h" + +namespace ash { +namespace shell { + +void PreMainMessageLoopStart() { + ui::RegisterPathProvider(); + icu_util::Initialize(); + ResourceBundle::InitSharedInstance("en-US"); + + scoped_nsobject<NSNib> + nib([[NSNib alloc] initWithNibNamed:@"MainMenu" + bundle:base::mac::MainAppBundle()]); + [nib instantiateNibWithOwner:NSApp topLevelObjects:nil]; +} + +} // namespace shell +} // namespace ash |