Merge pull request #62 from brightray/window-frame
Some tweaks on making application looks better
This commit is contained in:
commit
8ad833b333
7 changed files with 57 additions and 13 deletions
|
@ -24,8 +24,29 @@
|
|||
#include "browser/views/views_delegate.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/l10n/l10n_util_win.h"
|
||||
#include "ui/gfx/platform_font_win.h"
|
||||
#endif
|
||||
|
||||
namespace brightray {
|
||||
|
||||
#if defined(OS_WIN)
|
||||
namespace {
|
||||
|
||||
// gfx::Font callbacks
|
||||
void AdjustUIFont(LOGFONT* logfont) {
|
||||
l10n_util::AdjustUIFont(logfont);
|
||||
}
|
||||
|
||||
int GetMinimumFontSize() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
BrowserMainParts::BrowserMainParts() {
|
||||
}
|
||||
|
||||
|
@ -51,6 +72,11 @@ void BrowserMainParts::ToolkitInitialized() {
|
|||
#if defined(TOOLKIT_VIEWS)
|
||||
views_delegate_.reset(new ViewsDelegate);
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
gfx::PlatformFontWin::adjust_font_callback = &AdjustUIFont;
|
||||
gfx::PlatformFontWin::get_minimum_font_size_callback = &GetMinimumFontSize;
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserMainParts::PreMainMessageLoopStart() {
|
||||
|
|
|
@ -176,7 +176,7 @@ void InspectableWebContentsImpl::ActivateWindow() {
|
|||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseWindow() {
|
||||
CloseDevTools();
|
||||
devtools_web_contents()->GetMainFrame()->DispatchBeforeUnload(false);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::SetContentsResizingStrategy(
|
||||
|
@ -305,4 +305,8 @@ void InspectableWebContentsImpl::HandleKeyboardEvent(
|
|||
delegate->HandleKeyboardEvent(source, event);
|
||||
}
|
||||
|
||||
void InspectableWebContentsImpl::CloseContents(content::WebContents* source) {
|
||||
CloseDevTools();
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -109,6 +109,7 @@ class InspectableWebContentsImpl :
|
|||
|
||||
virtual void HandleKeyboardEvent(
|
||||
content::WebContents*, const content::NativeWebKeyboardEvent&) OVERRIDE;
|
||||
virtual void CloseContents(content::WebContents* source) OVERRIDE;
|
||||
|
||||
scoped_ptr<content::WebContents> web_contents_;
|
||||
scoped_ptr<content::DevToolsClientHost> frontend_host_;
|
||||
|
|
|
@ -140,7 +140,11 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked) {
|
|||
devtools_window_web_view_,
|
||||
devtools_window_.get());
|
||||
params.top_level = true;
|
||||
params.bounds = inspectable_web_contents()->GetDevToolsBounds();
|
||||
#if defined(USE_X11)
|
||||
// In X11 the window frame is drawn by the application.
|
||||
params.remove_standard_frame = true;
|
||||
#endif
|
||||
devtools_window_->Init(params);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "ui/views/linux_ui/linux_ui.h"
|
||||
#endif
|
||||
|
||||
namespace brightray {
|
||||
|
||||
ViewsDelegate::ViewsDelegate() {
|
||||
|
@ -85,7 +89,8 @@ void ViewsDelegate::OnBeforeWidgetInit(
|
|||
return;
|
||||
|
||||
// The native_widget is required when using aura.
|
||||
if (params->parent == NULL && params->context == NULL && !params->child)
|
||||
if (params->type == views::Widget::InitParams::TYPE_MENU ||
|
||||
(params->parent == NULL && params->context == NULL && !params->child))
|
||||
params->native_widget = new views::DesktopNativeWidgetAura(delegate);
|
||||
}
|
||||
|
||||
|
@ -95,7 +100,14 @@ base::TimeDelta ViewsDelegate::GetDefaultTextfieldObscuredRevealDuration() {
|
|||
}
|
||||
|
||||
bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
|
||||
return maximized;
|
||||
#if defined(OS_LINUX)
|
||||
// On Ubuntu Unity, the system always provides a title bar for maximized
|
||||
// windows.
|
||||
views::LinuxUI* ui = views::LinuxUI::instance();
|
||||
return maximized && ui && ui->UnityIsRunning();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -49,13 +49,7 @@ void MainDelegate::InitializeResourceBundle() {
|
|||
#endif
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
|
||||
|
||||
std::vector<base::FilePath> pak_paths;
|
||||
AddPakPaths(&pak_paths);
|
||||
for (auto it = pak_paths.begin(), end = pak_paths.end(); it != end; ++it) {
|
||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(
|
||||
*it, ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
AddDataPackFromPath(&ui::ResourceBundle::GetSharedInstance(), path.DirName());
|
||||
}
|
||||
|
||||
content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() {
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
#ifndef BRIGHTRAY_COMMON_MAIN_DELEGATE_H_
|
||||
#define BRIGHTRAY_COMMON_MAIN_DELEGATE_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "content/public/app/content_main_delegate.h"
|
||||
|
@ -15,6 +13,10 @@ namespace base {
|
|||
class FilePath;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
class ResourceBundle;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
||||
class BrowserClient;
|
||||
|
@ -36,7 +38,8 @@ class MainDelegate : public content::ContentMainDelegate {
|
|||
|
||||
// Subclasses can override this to provide additional .pak files to be
|
||||
// included in the ui::ResourceBundle.
|
||||
virtual void AddPakPaths(std::vector<base::FilePath>* pak_paths) {}
|
||||
virtual void AddDataPackFromPath(
|
||||
ui::ResourceBundle* bundle, const base::FilePath& pak_dir) {}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Subclasses can override this to custom the paths of child process and
|
||||
|
|
Loading…
Add table
Reference in a new issue