zoukankan      html  css  js  c++  java
  • 【技术应用】visual studio 2010 + chromium 更改代码 去掉地址栏

    看着ie9 firefox opera都效仿tab风格,对比了下,chrome的窗口上面部分还不够小,

    干脆把地址栏去掉,F10ALT键,显示隐藏地址栏,

    这里是我编译好的程序,喜欢的拿走(26M)

    chrome_notoobar_V12.part1

    chrome_notoobar_V12.part2 


    研究了下代码,更改如下:

     

    1、src\chrome\browser\ui\browser.h中

     

    //加入一个变量,记录当前 toolbar的显示状态

    bool toolbar_visible_;

     

     

    2、src\chrome\browser\ui\browser.cc中

     

    //构造函数中,给变量赋值

    Browser::Browser(Type type, Profile* profile)

        : type_(type),

     toolbar_visible_(false),

     ...

     

    ---------------------------------------------

    //修改SupportsWindowFeatureImpl函数中代码

    bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,

                                            bool check_fullscreen) const {

        ...

        if (type() == TYPE_NORMAL && toolbar_visible_==true)

          features |= FEATURE_TOOLBAR;

     

        if ((type() & Browser::TYPE_APP ) == 0 && toolbar_visible_==true)

          features |= FEATURE_LOCATIONBAR;

        ...

    ---------------------------------------------

    //FocusAppMenu函数中修改代码

    void Browser::FocusAppMenu() {

     UserMetrics::RecordAction(UserMetricsAction("FocusAppMenu"), profile_);

     //:ningth

     toolbar_visible_ = !toolbar_visible_;

     window_->FocusAppMenu();

    }

     

    3、src\chrome\browser\ui\views\frame\browser_view.cc中

    //修改FocusAppMenu中代码

    void BrowserView::FocusAppMenu() {

     // Chrome doesn't have a traditional menu bar, but it has a menu button in the

     // main toolbar that plays the same role. If the user presses a key that

     // would typically focus the menu bar, tell the toolbar to focus the menu

     // button. If the user presses the key again, return focus to the previous

     // location.

     //

     // Not used on the Mac, which has a normal menu bar.

     

     //:ningth

     Layout();

     

     SetFocusToLocationBar(true);

     /*if (toolbar_->IsAppMenuFocused()) {

        RestoreFocus();

     } else {

        SaveFocusedView();

        toolbar_->SetPaneFocusAndFocusAppMenu(last_focused_view_storage_id_);

     }*/

    }

     

     

    4、src\chrome\browser\ui\views\frame\browser_view_layout.cc中

    修改LayoutToolbar函数中的height值

    int BrowserViewLayout::LayoutToolbar(int top) {

     int browser_view_width = vertical_layout_rect_.width();

     bool visible = browser_view_->IsToolbarVisible();;

     toolbar_->location_bar()->SetFocusable(visible);

     int y = top;

     if (!browser_view_->UseVerticalTabs()) {

        y -= ((visible && browser_view_->IsTabStripVisible()) ?

              kToolbarTabStripVerticalOverlap : 0);

     }

     int height = visible ? toolbar_->GetPreferredSize().height() : 1;

     toolbar_->SetVisible(visible);

     toolbar_->SetBounds(vertical_layout_rect_.x(), y, browser_view_width, height);

     

     return y + height;

    }

  • 相关阅读:
    jQuery 插件
    jQuery 构造函数
    jQuery.merge()方法
    插入排序法
    归并排序法
    冒泡排序法
    选择排序法
    Jetty
    分布式锁&&redis
    Tomcat和设计模式
  • 原文地址:https://www.cnblogs.com/ningth/p/2008747.html
Copyright © 2011-2022 走看看