forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10054038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132063 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
ben@chromium.org
committed
Apr 12, 2012
1 parent
d78e2b2
commit fa4a458
Showing
19 changed files
with
1,075 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include_rules = [ | ||
"+content", | ||
"+sandbox", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
include_rules = [ | ||
"+content", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// 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/content_client/shell_browser_main_parts.h" | ||
|
||
#include "ash/shell/shell_delegate_impl.h" | ||
#include "ash/shell/window_watcher.h" | ||
#include "base/bind.h" | ||
#include "base/command_line.h" | ||
#include "base/i18n/icu_util.h" | ||
#include "base/message_loop.h" | ||
#include "base/string_number_conversions.h" | ||
#include "base/threading/thread.h" | ||
#include "base/threading/thread_restrictions.h" | ||
#include "content/public/common/content_switches.h" | ||
#include "content/shell/shell.h" | ||
#include "content/shell/shell_browser_context.h" | ||
#include "content/shell/shell_devtools_delegate.h" | ||
#include "content/shell/shell_switches.h" | ||
#include "googleurl/src/gurl.h" | ||
#include "net/base/net_module.h" | ||
#include "ui/aura/client/stacking_client.h" | ||
#include "ui/aura/env.h" | ||
#include "ui/aura/root_window.h" | ||
#include "ui/aura/window.h" | ||
#include "ui/base/clipboard/clipboard.h" | ||
#include "ui/base/resource/resource_bundle.h" | ||
#include "ui/base/ui_base_paths.h" | ||
#include "ui/gfx/compositor/compositor.h" | ||
#include "ui/gfx/compositor/test/compositor_test_support.h" | ||
#include "ui/views/test/test_views_delegate.h" | ||
#include "ui/views/focus/accelerator_handler.h" | ||
|
||
namespace ash { | ||
namespace shell { | ||
void InitWindowTypeLauncher(); | ||
|
||
namespace { | ||
class ShellViewsDelegate : public views::TestViewsDelegate { | ||
public: | ||
ShellViewsDelegate() {} | ||
virtual ~ShellViewsDelegate() {} | ||
|
||
// Overridden from views::TestViewsDelegate: | ||
virtual views::NonClientFrameView* CreateDefaultNonClientFrameView( | ||
views::Widget* widget) OVERRIDE { | ||
return ash::Shell::GetInstance()->CreateDefaultNonClientFrameView(widget); | ||
} | ||
bool UseTransparentWindows() const OVERRIDE { | ||
// Ash uses transparent window frames. | ||
return true; | ||
} | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(ShellViewsDelegate); | ||
}; | ||
|
||
} // namespace | ||
|
||
ShellBrowserMainParts::ShellBrowserMainParts( | ||
const content::MainFunctionParams& parameters) | ||
: BrowserMainParts(), | ||
devtools_delegate_(NULL) { | ||
} | ||
|
||
ShellBrowserMainParts::~ShellBrowserMainParts() { | ||
} | ||
|
||
#if !defined(OS_MACOSX) | ||
void ShellBrowserMainParts::PreMainMessageLoopStart() { | ||
} | ||
#endif | ||
|
||
int ShellBrowserMainParts::PreCreateThreads() { | ||
return 0; | ||
} | ||
|
||
void ShellBrowserMainParts::PreMainMessageLoopRun() { | ||
browser_context_.reset(new content::ShellBrowserContext); | ||
|
||
// A ViewsDelegate is required. | ||
if (!views::ViewsDelegate::views_delegate) | ||
views::ViewsDelegate::views_delegate = new ShellViewsDelegate; | ||
|
||
ash::shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; | ||
ash::Shell::CreateInstance(delegate); | ||
ash::Shell::GetInstance()->set_browser_context(browser_context_.get()); | ||
|
||
window_watcher_.reset(new ash::shell::WindowWatcher); | ||
delegate->SetWatcher(window_watcher_.get()); | ||
|
||
ash::shell::InitWindowTypeLauncher(); | ||
|
||
ash::Shell::GetRootWindow()->ShowRootWindow(); | ||
} | ||
|
||
void ShellBrowserMainParts::PostMainMessageLoopRun() { | ||
if (devtools_delegate_) | ||
devtools_delegate_->Stop(); | ||
browser_context_.reset(); | ||
|
||
window_watcher_.reset(); | ||
ash::Shell::DeleteInstance(); | ||
aura::Env::DeleteInstance(); | ||
} | ||
|
||
bool ShellBrowserMainParts::MainMessageLoopRun(int* result_code) { | ||
MessageLoopForUI::current()->Run(); | ||
return true; | ||
} | ||
|
||
ui::Clipboard* ShellBrowserMainParts::GetClipboard() { | ||
if (!clipboard_.get()) | ||
clipboard_.reset(new ui::Clipboard()); | ||
return clipboard_.get(); | ||
} | ||
|
||
} // namespace shell | ||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// 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_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ | ||
#define ASH_SHELL_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ | ||
#pragma once | ||
|
||
#include "base/basictypes.h" | ||
#include "base/memory/scoped_ptr.h" | ||
#include "content/public/browser/browser_main_parts.h" | ||
|
||
namespace base { | ||
class Thread; | ||
} | ||
|
||
namespace ui { | ||
class Clipboard; | ||
} | ||
|
||
namespace content { | ||
class ShellBrowserContext; | ||
class ShellDevToolsDelegate; | ||
struct MainFunctionParams; | ||
} | ||
|
||
namespace views { | ||
class ViewsDelegate; | ||
} | ||
|
||
namespace ash { | ||
namespace shell { | ||
|
||
class WindowWatcher; | ||
|
||
class ShellBrowserMainParts : public content::BrowserMainParts { | ||
public: | ||
explicit ShellBrowserMainParts( | ||
const content::MainFunctionParams& parameters); | ||
virtual ~ShellBrowserMainParts(); | ||
|
||
// Overridden from content::BrowserMainParts: | ||
virtual void PreEarlyInitialization() OVERRIDE {} | ||
virtual void PostEarlyInitialization() OVERRIDE {} | ||
virtual void PreMainMessageLoopStart() OVERRIDE; | ||
virtual void PostMainMessageLoopStart() OVERRIDE {} | ||
virtual void ToolkitInitialized() OVERRIDE {} | ||
virtual int PreCreateThreads() OVERRIDE; | ||
virtual void PreMainMessageLoopRun() OVERRIDE; | ||
virtual bool MainMessageLoopRun(int* result_code) OVERRIDE; | ||
virtual void PostMainMessageLoopRun() OVERRIDE; | ||
virtual void PostDestroyThreads() OVERRIDE {} | ||
|
||
ui::Clipboard* GetClipboard(); | ||
content::ShellDevToolsDelegate* devtools_delegate() { | ||
return devtools_delegate_; | ||
} | ||
|
||
content::ShellBrowserContext* browser_context() { | ||
return browser_context_.get(); | ||
} | ||
|
||
private: | ||
scoped_ptr<content::ShellBrowserContext> browser_context_; | ||
|
||
scoped_ptr<ui::Clipboard> clipboard_; | ||
content::ShellDevToolsDelegate* devtools_delegate_; | ||
scoped_ptr<views::ViewsDelegate> views_delegate_; | ||
scoped_ptr<ash::shell::WindowWatcher> window_watcher_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(ShellBrowserMainParts); | ||
}; | ||
|
||
} // namespace shell | ||
} // namespace ash | ||
|
||
#endif // ASH_SHELL_CONTENT_CLIENT_EXAMPLES_BROWSER_MAIN_PARTS_H_ |
Oops, something went wrong.