Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/ui/webui/set_as_default_browser_ui.cc

Issue 10837084: The updated (simplified) look of set-as-default dialog on Windows8. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed up css/html to meet the new design. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/set_as_default_browser_ui.h" 5 #include "chrome/browser/ui/webui/set_as_default_browser_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/browser/first_run/first_run.h" 10 #include "chrome/browser/first_run/first_run.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 ChromeWebUIDataSource* CreateSetAsDefaultBrowserUIHTMLSource() { 44 ChromeWebUIDataSource* CreateSetAsDefaultBrowserUIHTMLSource() {
45 ChromeWebUIDataSource* data_source = new ChromeWebUIDataSource( 45 ChromeWebUIDataSource* data_source = new ChromeWebUIDataSource(
46 chrome::kChromeUIMetroFlowHost); 46 chrome::kChromeUIMetroFlowHost);
47 data_source->AddLocalizedString("page-title", IDS_METRO_FLOW_TAB_TITLE); 47 data_source->AddLocalizedString("page-title", IDS_METRO_FLOW_TAB_TITLE);
48 data_source->AddLocalizedString("flowTitle", IDS_METRO_FLOW_TITLE_SHORT); 48 data_source->AddLocalizedString("flowTitle", IDS_METRO_FLOW_TITLE_SHORT);
49 data_source->AddLocalizedString("flowDescription", 49 data_source->AddLocalizedString("flowDescription",
50 IDS_METRO_FLOW_DESCRIPTION); 50 IDS_METRO_FLOW_DESCRIPTION);
51 data_source->AddLocalizedString("flowNext", 51 data_source->AddLocalizedString("flowNext",
52 IDS_METRO_FLOW_SET_DEFAULT); 52 IDS_METRO_FLOW_SET_DEFAULT);
53 data_source->AddLocalizedString("flowCancel",
54 IDS_METRO_FLOW_SET_DEFAULT_CANCEL);
55 data_source->set_json_path("strings.js"); 53 data_source->set_json_path("strings.js");
56 data_source->add_resource_path("set_as_default_browser.js", 54 data_source->add_resource_path("set_as_default_browser.js",
57 IDR_SET_AS_DEFAULT_BROWSER_JS); 55 IDR_SET_AS_DEFAULT_BROWSER_JS);
58 data_source->set_default_resource(IDR_SET_AS_DEFAULT_BROWSER_HTML); 56 data_source->set_default_resource(IDR_SET_AS_DEFAULT_BROWSER_HTML);
59 return data_source; 57 return data_source;
60 } 58 }
61 59
62 // Event handler for SetAsDefaultBrowserUI. Capable of setting Chrome as the 60 // Event handler for SetAsDefaultBrowserUI. Capable of setting Chrome as the
63 // default browser on button click, closing itself and triggering Chrome 61 // default browser on button click, closing itself and triggering Chrome
64 // restart. 62 // restart.
(...skipping 11 matching lines...) Expand all
76 // ShellIntegration::DefaultWebClientObserver implementation. 74 // ShellIntegration::DefaultWebClientObserver implementation.
77 virtual void SetDefaultWebClientUIState( 75 virtual void SetDefaultWebClientUIState(
78 ShellIntegration::DefaultWebClientUIState state) OVERRIDE; 76 ShellIntegration::DefaultWebClientUIState state) OVERRIDE;
79 virtual void OnSetAsDefaultConcluded(bool call_result) OVERRIDE; 77 virtual void OnSetAsDefaultConcluded(bool call_result) OVERRIDE;
80 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE; 78 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE;
81 79
82 private: 80 private:
83 // Handler for the 'Next' (or 'make Chrome the Metro browser') button. 81 // Handler for the 'Next' (or 'make Chrome the Metro browser') button.
84 void HandleLaunchSetDefaultBrowserFlow(const ListValue* args); 82 void HandleLaunchSetDefaultBrowserFlow(const ListValue* args);
85 83
86 // Handler for the 'No, thanks' (Cancel) button.
87 void HandleReturnToBrowser(const ListValue* args);
88
89 // Close this web ui. 84 // Close this web ui.
90 void ConcludeInteraction(); 85 void ConcludeInteraction();
91 86
92 // If required and possible, spawns a new Chrome in Metro mode and closes the 87 // If required and possible, spawns a new Chrome in Metro mode and closes the
93 // current instance. Windows 8 only, on earlier systems it will simply close 88 // current instance. Windows 8 only, on earlier systems it will simply close
94 // this UI. 89 // this UI.
95 void ActivateMetroChrome(); 90 void ActivateMetroChrome();
96 91
97 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; 92 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
98 bool set_default_returned_; 93 bool set_default_returned_;
(...skipping 10 matching lines...) Expand all
109 104
110 SetAsDefaultBrowserHandler::~SetAsDefaultBrowserHandler() { 105 SetAsDefaultBrowserHandler::~SetAsDefaultBrowserHandler() {
111 default_browser_worker_->ObserverDestroyed(); 106 default_browser_worker_->ObserverDestroyed();
112 } 107 }
113 108
114 void SetAsDefaultBrowserHandler::RegisterMessages() { 109 void SetAsDefaultBrowserHandler::RegisterMessages() {
115 web_ui()->RegisterMessageCallback( 110 web_ui()->RegisterMessageCallback(
116 "SetAsDefaultBrowser:LaunchSetDefaultBrowserFlow", 111 "SetAsDefaultBrowser:LaunchSetDefaultBrowserFlow",
117 base::Bind(&SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow, 112 base::Bind(&SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow,
118 base::Unretained(this))); 113 base::Unretained(this)));
119 web_ui()->RegisterMessageCallback(
120 "SetAsDefaultBrowser:ReturnToBrowser",
121 base::Bind(&SetAsDefaultBrowserHandler::HandleReturnToBrowser,
122 base::Unretained(this)));
123 } 114 }
124 115
125 void SetAsDefaultBrowserHandler::SetDefaultWebClientUIState( 116 void SetAsDefaultBrowserHandler::SetDefaultWebClientUIState(
126 ShellIntegration::DefaultWebClientUIState state) { 117 ShellIntegration::DefaultWebClientUIState state) {
127 // The callback is expected to be invoked once the procedure has completed. 118 // The callback is expected to be invoked once the procedure has completed.
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 if (!set_default_returned_) 120 if (!set_default_returned_)
130 return; 121 return;
131 122
132 if (state == ShellIntegration::STATE_NOT_DEFAULT && set_default_result_) { 123 if (state == ShellIntegration::STATE_NOT_DEFAULT && set_default_result_) {
(...skipping 18 matching lines...) Expand all
151 return true; 142 return true;
152 } 143 }
153 144
154 void SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow( 145 void SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow(
155 const ListValue* args) { 146 const ListValue* args) {
156 set_default_returned_ = false; 147 set_default_returned_ = false;
157 set_default_result_ = false; 148 set_default_result_ = false;
158 default_browser_worker_->StartSetAsDefault(); 149 default_browser_worker_->StartSetAsDefault();
159 } 150 }
160 151
161 void SetAsDefaultBrowserHandler::HandleReturnToBrowser(const ListValue* args) {
162 ConcludeInteraction();
163 }
164
165 void SetAsDefaultBrowserHandler::ConcludeInteraction() { 152 void SetAsDefaultBrowserHandler::ConcludeInteraction() {
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
167 WebContents* contents = web_ui()->GetWebContents(); 154 WebContents* contents = web_ui()->GetWebContents();
168 if (contents) { 155 if (contents) {
169 content::WebContentsDelegate* delegate = contents->GetDelegate(); 156 content::WebContentsDelegate* delegate = contents->GetDelegate();
170 if (delegate) { 157 if (delegate) {
171 if (!delegate->IsPopupOrPanel(contents)) { 158 if (!delegate->IsPopupOrPanel(contents)) {
172 Browser* browser = browser::FindBrowserWithWebContents(contents); 159 Browser* browser = browser::FindBrowserWithWebContents(contents);
173 if (browser) 160 if (browser)
174 chrome::ShowSyncSetup(browser, SyncPromoUI::SOURCE_START_PAGE); 161 chrome::ShowSyncSetup(browser, SyncPromoUI::SOURCE_START_PAGE);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 new SetAsDefaultBrowserDialogImpl(profile, browser); 309 new SetAsDefaultBrowserDialogImpl(profile, browser);
323 dialog->ShowDialog(); 310 dialog->ShowDialog();
324 } else { 311 } else {
325 GURL url(chrome::kChromeUIMetroFlowURL); 312 GURL url(chrome::kChromeUIMetroFlowURL);
326 chrome::NavigateParams params( 313 chrome::NavigateParams params(
327 chrome::GetSingletonTabNavigateParams(browser, url)); 314 chrome::GetSingletonTabNavigateParams(browser, url));
328 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; 315 params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
329 chrome::ShowSingletonTabOverwritingNTP(browser, params); 316 chrome::ShowSingletonTabOverwritingNTP(browser, params);
330 } 317 }
331 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698