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

Unified Diff: chrome/browser/chromeos/enrollment_dialog_view.cc

Issue 12089026: Fixing opening a new tab if none exists to show the enrollment URI for certificates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments and calling navigate after dialog closed. Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/enrollment_dialog_view.cc
diff --git a/chrome/browser/chromeos/enrollment_dialog_view.cc b/chrome/browser/chromeos/enrollment_dialog_view.cc
index cfab93da7affe423e7325dba572a92c394d86f0e..07e77c6bfe70c506628216a7828026ad539f1b8c 100644
--- a/chrome/browser/chromeos/enrollment_dialog_view.cc
+++ b/chrome/browser/chromeos/enrollment_dialog_view.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/host_desktop.h"
#include "content/public/common/page_transition_types.h"
#include "extensions/common/constants.h"
@@ -46,6 +46,7 @@ class EnrollmentDialogView : public views::DialogDelegateView {
// views::DialogDelegateView overrides
virtual int GetDialogButtons() const OVERRIDE;
virtual bool Accept() OVERRIDE;
+ virtual void OnClose() OVERRIDE;
virtual string16 GetDialogButtonLabel(ui::DialogButton button) const OVERRIDE;
// views::WidgetDelegate overrides
@@ -62,6 +63,7 @@ class EnrollmentDialogView : public views::DialogDelegateView {
const base::Closure& connect);
void InitDialog();
+ bool accepted_;
std::string network_name_;
Profile* profile_;
GURL target_uri_;
@@ -76,7 +78,8 @@ EnrollmentDialogView::EnrollmentDialogView(const std::string& network_name,
Profile* profile,
const GURL& target_uri,
const base::Closure& connect)
- : network_name_(network_name),
+ : accepted_(false),
+ network_name_(network_name),
profile_(profile),
target_uri_(target_uri),
connect_(connect),
@@ -106,21 +109,22 @@ int EnrollmentDialogView::GetDialogButtons() const {
}
bool EnrollmentDialogView::Accept() {
- // TODO(beng): use Navigate().
- // Navigate to the target URI in a browser tab.
- Browser* browser = chrome::FindTabbedBrowser(profile_, false,
- chrome::HOST_DESKTOP_TYPE_ASH);
- if (!browser) {
- // Couldn't find a tabbed browser: create one.
- browser = new Browser(
- Browser::CreateParams(Browser::TYPE_TABBED,
- profile_,
- chrome::HOST_DESKTOP_TYPE_ASH));
- }
+ accepted_ = true;
+ return true;
+}
+
+void EnrollmentDialogView::OnClose() {
+ if (!accepted_)
+ return;
+ Browser* browser = chrome::FindOrCreateTabbedBrowser(
+ profile_,
+ chrome::HOST_DESKTOP_TYPE_ASH);
DCHECK(browser);
- chrome::AddSelectedTabWithURL(browser, target_uri_,
+ chrome::NavigateParams params(browser,
+ GURL(target_uri_),
content::PAGE_TRANSITION_LINK);
- return true;
+ params.disposition = NEW_FOREGROUND_TAB;
+ chrome::Navigate(&params);
}
sky 2013/03/18 16:10:48 This should set params.window_action to SHOW_WINDO
string16 EnrollmentDialogView::GetDialogButtonLabel(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698