OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/views/profiles/user_manager_view.h" | 5 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 ReauthDelegate(); | 67 ReauthDelegate(); |
68 // views::DialogDelegate: | 68 // views::DialogDelegate: |
69 gfx::Size GetPreferredSize() const override; | 69 gfx::Size GetPreferredSize() const override; |
70 bool CanResize() const override; | 70 bool CanResize() const override; |
71 bool CanMaximize() const override; | 71 bool CanMaximize() const override; |
72 bool CanMinimize() const override; | 72 bool CanMinimize() const override; |
73 bool UseNewStyleForThisDialog() const override; | 73 bool UseNewStyleForThisDialog() const override; |
74 ui::ModalType GetModalType() const override; | 74 ui::ModalType GetModalType() const override; |
75 void DeleteDelegate() override; | 75 void DeleteDelegate() override; |
76 base::string16 GetWindowTitle() const override; | 76 base::string16 GetWindowTitle() const override; |
77 int GetDialogButtons() const override; | 77 int GetDialogButtons() const override; |
sky
2015/09/14 21:33:06
How about overriding GetInitiallyFocusedView?
gogerald1
2015/09/14 22:27:03
Done.
| |
78 | 78 |
79 // UserManager::ReauthObserver: | 79 // UserManager::ReauthObserver: |
80 void CloseReauthDialog() override; | 80 void CloseReauthDialog() override; |
81 | 81 |
82 views::WebView* web_view_; | 82 views::WebView* web_view_; |
83 const std::string email_address_; | 83 const std::string email_address_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(ReauthDelegate); | 85 DISALLOW_COPY_AND_ASSIGN(ReauthDelegate); |
86 }; | 86 }; |
87 | 87 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 | 207 |
208 // static | 208 // static |
209 void UserManager::ShowReauthDialog(content::BrowserContext* browser_context, | 209 void UserManager::ShowReauthDialog(content::BrowserContext* browser_context, |
210 const std::string& email) { | 210 const std::string& email) { |
211 // This method should only be called if the user manager is already showing. | 211 // This method should only be called if the user manager is already showing. |
212 if (!IsShowing()) | 212 if (!IsShowing()) |
213 return; | 213 return; |
214 | 214 |
215 // The dialog delegate will be deleted when the dialog closes and the created | 215 // The dialog delegate will be deleted when the dialog closes and the created |
216 // WebView's lifetime is managed by the delegate. | 216 // WebView's lifetime is managed by the delegate. |
217 views::DialogDelegate* delegate = | 217 views::WebView* web_view = new views::WebView(browser_context); |
218 new ReauthDelegate(new views::WebView(browser_context), email); | 218 views::DialogDelegate* delegate = new ReauthDelegate(web_view, email); |
219 gfx::NativeView parent = instance_->GetWidget()->GetNativeView(); | 219 gfx::NativeView parent = instance_->GetWidget()->GetNativeView(); |
220 views::DialogDelegate::CreateDialogWidget(delegate, nullptr, parent); | 220 views::DialogDelegate::CreateDialogWidget(delegate, nullptr, parent); |
221 delegate->GetWidget()->Show(); | 221 delegate->GetWidget()->Show(); |
222 web_view->RequestFocus(); | |
222 } | 223 } |
223 | 224 |
224 // UserManagerView ------------------------------------------------------------- | 225 // UserManagerView ------------------------------------------------------------- |
225 | 226 |
226 UserManagerView::UserManagerView() | 227 UserManagerView::UserManagerView() |
227 : web_view_(NULL), | 228 : web_view_(NULL), |
228 keep_alive_(new AutoKeepAlive(NULL)), | 229 keep_alive_(new AutoKeepAlive(NULL)), |
229 user_manager_started_showing_(base::Time()) { | 230 user_manager_started_showing_(base::Time()) { |
230 } | 231 } |
231 | 232 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 // Now that the window is closed, we can allow a new one to be opened. | 368 // Now that the window is closed, we can allow a new one to be opened. |
368 // (WindowClosing comes in asynchronously from the call to Close() and we | 369 // (WindowClosing comes in asynchronously from the call to Close() and we |
369 // may have already opened a new instance). | 370 // may have already opened a new instance). |
370 if (instance_ == this) | 371 if (instance_ == this) |
371 instance_ = NULL; | 372 instance_ = NULL; |
372 } | 373 } |
373 | 374 |
374 bool UserManagerView::UseNewStyleForThisDialog() const { | 375 bool UserManagerView::UseNewStyleForThisDialog() const { |
375 return false; | 376 return false; |
376 } | 377 } |
OLD | NEW |