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

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: Split the bitmap into a separate CL. 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
« no previous file with comments | « chrome/browser/resources/set_as_default_browser.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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", 53 data_source->AddLocalizedString("chromeLogoString",
54 IDS_METRO_FLOW_SET_DEFAULT_CANCEL); 54 IDS_METRO_FLOW_LOGO_STRING_ALT);
55 data_source->set_json_path("strings.js"); 55 data_source->set_json_path("strings.js");
56 data_source->add_resource_path("set_as_default_browser.js", 56 data_source->add_resource_path("set_as_default_browser.js",
57 IDR_SET_AS_DEFAULT_BROWSER_JS); 57 IDR_SET_AS_DEFAULT_BROWSER_JS);
58 data_source->set_default_resource(IDR_SET_AS_DEFAULT_BROWSER_HTML); 58 data_source->set_default_resource(IDR_SET_AS_DEFAULT_BROWSER_HTML);
59 return data_source; 59 return data_source;
60 } 60 }
61 61
62 // Event handler for SetAsDefaultBrowserUI. Capable of setting Chrome as the 62 // Event handler for SetAsDefaultBrowserUI. Capable of setting Chrome as the
63 // default browser on button click, closing itself and triggering Chrome 63 // default browser on button click, closing itself and triggering Chrome
64 // restart. 64 // restart.
(...skipping 11 matching lines...) Expand all
76 // ShellIntegration::DefaultWebClientObserver implementation. 76 // ShellIntegration::DefaultWebClientObserver implementation.
77 virtual void SetDefaultWebClientUIState( 77 virtual void SetDefaultWebClientUIState(
78 ShellIntegration::DefaultWebClientUIState state) OVERRIDE; 78 ShellIntegration::DefaultWebClientUIState state) OVERRIDE;
79 virtual void OnSetAsDefaultConcluded(bool call_result) OVERRIDE; 79 virtual void OnSetAsDefaultConcluded(bool call_result) OVERRIDE;
80 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE; 80 virtual bool IsInteractiveSetDefaultPermitted() OVERRIDE;
81 81
82 private: 82 private:
83 // Handler for the 'Next' (or 'make Chrome the Metro browser') button. 83 // Handler for the 'Next' (or 'make Chrome the Metro browser') button.
84 void HandleLaunchSetDefaultBrowserFlow(const ListValue* args); 84 void HandleLaunchSetDefaultBrowserFlow(const ListValue* args);
85 85
86 // Handler for the 'No, thanks' (Cancel) button.
87 void HandleReturnToBrowser(const ListValue* args);
88
89 // Close this web ui. 86 // Close this web ui.
90 void ConcludeInteraction(); 87 void ConcludeInteraction();
91 88
92 // If required and possible, spawns a new Chrome in Metro mode and closes the 89 // 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 90 // current instance. Windows 8 only, on earlier systems it will simply close
94 // this UI. 91 // this UI.
95 void ActivateMetroChrome(); 92 void ActivateMetroChrome();
96 93
97 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_; 94 scoped_refptr<ShellIntegration::DefaultBrowserWorker> default_browser_worker_;
98 bool set_default_returned_; 95 bool set_default_returned_;
(...skipping 10 matching lines...) Expand all
109 106
110 SetAsDefaultBrowserHandler::~SetAsDefaultBrowserHandler() { 107 SetAsDefaultBrowserHandler::~SetAsDefaultBrowserHandler() {
111 default_browser_worker_->ObserverDestroyed(); 108 default_browser_worker_->ObserverDestroyed();
112 } 109 }
113 110
114 void SetAsDefaultBrowserHandler::RegisterMessages() { 111 void SetAsDefaultBrowserHandler::RegisterMessages() {
115 web_ui()->RegisterMessageCallback( 112 web_ui()->RegisterMessageCallback(
116 "SetAsDefaultBrowser:LaunchSetDefaultBrowserFlow", 113 "SetAsDefaultBrowser:LaunchSetDefaultBrowserFlow",
117 base::Bind(&SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow, 114 base::Bind(&SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow,
118 base::Unretained(this))); 115 base::Unretained(this)));
119 web_ui()->RegisterMessageCallback(
120 "SetAsDefaultBrowser:ReturnToBrowser",
121 base::Bind(&SetAsDefaultBrowserHandler::HandleReturnToBrowser,
122 base::Unretained(this)));
123 } 116 }
124 117
125 void SetAsDefaultBrowserHandler::SetDefaultWebClientUIState( 118 void SetAsDefaultBrowserHandler::SetDefaultWebClientUIState(
126 ShellIntegration::DefaultWebClientUIState state) { 119 ShellIntegration::DefaultWebClientUIState state) {
127 // The callback is expected to be invoked once the procedure has completed. 120 // The callback is expected to be invoked once the procedure has completed.
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 if (!set_default_returned_) 122 if (!set_default_returned_)
130 return; 123 return;
131 124
132 if (state == ShellIntegration::STATE_NOT_DEFAULT && set_default_result_) { 125 if (state == ShellIntegration::STATE_NOT_DEFAULT && set_default_result_) {
(...skipping 23 matching lines...) Expand all
156 return true; 149 return true;
157 } 150 }
158 151
159 void SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow( 152 void SetAsDefaultBrowserHandler::HandleLaunchSetDefaultBrowserFlow(
160 const ListValue* args) { 153 const ListValue* args) {
161 set_default_returned_ = false; 154 set_default_returned_ = false;
162 set_default_result_ = false; 155 set_default_result_ = false;
163 default_browser_worker_->StartSetAsDefault(); 156 default_browser_worker_->StartSetAsDefault();
164 } 157 }
165 158
166 void SetAsDefaultBrowserHandler::HandleReturnToBrowser(const ListValue* args) {
167 ConcludeInteraction();
168 }
169
170 void SetAsDefaultBrowserHandler::ConcludeInteraction() { 159 void SetAsDefaultBrowserHandler::ConcludeInteraction() {
171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
172 WebContents* contents = web_ui()->GetWebContents(); 161 WebContents* contents = web_ui()->GetWebContents();
173 if (contents) { 162 if (contents) {
174 content::WebContentsDelegate* delegate = contents->GetDelegate(); 163 content::WebContentsDelegate* delegate = contents->GetDelegate();
175 if (delegate) 164 if (delegate)
176 delegate->CloseContents(contents); 165 delegate->CloseContents(contents);
177 } 166 }
178 } 167 }
179 168
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 CreateSetAsDefaultBrowserUIHTMLSource()); 299 CreateSetAsDefaultBrowserUIHTMLSource());
311 } 300 }
312 301
313 // static 302 // static
314 void SetAsDefaultBrowserUI::Show(Profile* profile, Browser* browser) { 303 void SetAsDefaultBrowserUI::Show(Profile* profile, Browser* browser) {
315 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 304 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
316 SetAsDefaultBrowserDialogImpl* dialog = 305 SetAsDefaultBrowserDialogImpl* dialog =
317 new SetAsDefaultBrowserDialogImpl(profile, browser); 306 new SetAsDefaultBrowserDialogImpl(profile, browser);
318 dialog->ShowDialog(); 307 dialog->ShowDialog();
319 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/set_as_default_browser.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698