日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

谷歌瀏覽器的源碼分析(4)

系統 2192 0

關于對話框,主要實現了讓用戶查看當前軟件的版本、軟件信息和檢查升級的功能。因此這個類主要繼續 ChromeViews::View 類、 ChromeViews::DialogDelegate GoogleUpdateStatusListener 。其中 ChromeViews::View 實現窗口的布局和顯示問題, ChromeViews::DialogDelegate 實現了事件響應,或者窗口某時是否可以顯示按鈕的問題, GoogleUpdateStatusListener 是用來實現接收更新程序狀態信息。

?

這個類的聲明如下:

class AboutChromeView : public ChromeViews::View,

??????????????????????? public ChromeViews::DialogDelegate,

??????????????????????? public GoogleUpdateStatusListener {

? public:

? explicit AboutChromeView(Profile* profile);

? virtual ~AboutChromeView();

?

? // Initialize the controls on the dialog.

? void Init();

?

? // Overridden from ChromeViews::View:

? virtual void GetPreferredSize(CSize *out);

? virtual void Layout();

? virtual void ViewHierarchyChanged(bool is_add,

????????????????????????????????? ?? ChromeViews::View* parent,

??????????????????????????????????? ChromeViews::View* child);

?

? // Overridden from ChromeViews::DialogDelegate:

? virtual int GetDialogButtons() const;

? virtual std::wstring GetDialogButtonLabel(DialogButton button) const;

? ? virtual bool IsDialogButtonEnabled(DialogButton button) const;

? virtual bool IsDialogButtonVisible(DialogButton button) const;

? virtual bool CanResize() const;

? virtual bool CanMaximize() const;

? virtual bool IsAlwaysOnTop() const;

? virtual bool HasAlwaysOnTopMenu() const;

? virtual bool IsModal() const;

? virtual std::wstring GetWindowTitle() const;

? virtual bool Accept();

? virtual ChromeViews::View* GetContentsView();

?

? // Overridden from GoogleUpdateStatusListener:

? virtual void OnReportResults(GoogleUpdateUpgradeResult result,

?????????????????????????????? GoogleUpdateErrorCode error_code,

?????????????????????????????? const std::wstring& version);

?

? private:

? // The visible state of the Check For Updates button.

? enum CheckButtonStatus {

? ?? CHECKBUTTON_HIDDEN = 0,

??? CHECKBUTTON_DISABLED,

??? CHECKBUTTON_ENABLED,

? };

?

? // Update the UI to show the status of the upgrade.

? void UpdateStatus(GoogleUpdateUpgradeResult result,

??????????????????? GoogleUpdateErrorCode error_code);

?

? Profile* profile_;

?

? // UI elements on the dialog.

? ChromeViews::ImageView* about_dlg_background_;

? ChromeViews::Label* about_title_label_;

? ChromeViews::TextField* version_label_;

? ChromeViews::TextField* main_text_label_;

? // UI elements we add to the parent view.

? scoped_ptr<ChromeViews::Throbber> throbber_;

? ChromeViews::ImageView success_indicator_;

? ChromeViews::ImageView update_available_indicator_;

? ChromeViews::ImageView timeout_indicator_;

? ChromeViews::Label update_label_;

?

? // Keeps track of the visible state of the Check For Updates button.

? CheckButtonStatus check_button_status_;

?

? // The class that communicates with Google Update to find out if an update is

? // available and asks it to start an upgrade.

? GoogleUpdate* google_updater_;

?

? // Our current version.

? std::wstring current_version_;

?

? // The version Google Update reports is available to us.

? std::wstring new_version_available_;

?

? DISALLOW_EVIL_CONSTRUCTORS(AboutChromeView);

};

?

通過關于對話框的分析,可以理解到 chrome 瀏覽器窗口基本組成,以及窗口繼承關系,還有事件的響應方式。前面三次分析,主要是入門的分析,也是了解這么一個大工程的一種手段。比如測試整個工程是否可以編譯,是否可以修改代碼等等。后面的分析會以瀏覽器輸入 HTTP 連接開始,直到打開網頁顯示為一個主線,做一個基本的分析。

?

谷歌瀏覽器的源碼分析(4)


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 桑日县| 景洪市| 江永县| 同德县| 蒙自县| 苗栗市| 桃园县| 和静县| 桂阳县| 昌图县| 英山县| 平度市| 北辰区| 建始县| 綦江县| 大兴区| 通城县| 禹州市| 麻栗坡县| 盐津县| 峨边| 井研县| 昆明市| 山丹县| 葫芦岛市| 林周县| 互助| 沧州市| 延吉市| 阳原县| 五原县| 新绛县| 铅山县| 孟津县| 花垣县| 万年县| 永胜县| 本溪市| 富蕴县| 平果县| 上虞市|