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

Side by Side Diff: chrome/browser/jsmessage_box_handler.cc

Issue 15023: Focus the textfield when doing a JS prompt (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years 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/jsmessage_box_handler.h ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/jsmessage_box_handler.h" 5 #include "chrome/browser/jsmessage_box_handler.h"
6 6
7 #include "chrome/browser/app_modal_dialog_queue.h" 7 #include "chrome/browser/app_modal_dialog_queue.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/web_contents.h" 9 #include "chrome/browser/web_contents.h"
10 #include "chrome/common/gfx/text_elider.h" 10 #include "chrome/common/gfx/text_elider.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 dialog_->Activate(); 145 dialog_->Activate();
146 } 146 }
147 147
148 /////////////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////////////
149 // JavascriptMessageBoxHandler, views::WindowDelegate implementation: 149 // JavascriptMessageBoxHandler, views::WindowDelegate implementation:
150 150
151 views::View* JavascriptMessageBoxHandler::GetContentsView() { 151 views::View* JavascriptMessageBoxHandler::GetContentsView() {
152 return message_box_view_; 152 return message_box_view_;
153 } 153 }
154 154
155 views::View* JavascriptMessageBoxHandler::GetInitiallyFocusedView() const {
156 if (message_box_view_->text_box())
157 return message_box_view_->text_box();
158 return views::AppModalDialogDelegate::GetInitiallyFocusedView();
159 }
160
155 /////////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////////
156 // JavascriptMessageBoxHandler, private: 162 // JavascriptMessageBoxHandler, private:
157 163
158 void JavascriptMessageBoxHandler::Observe(NotificationType type, 164 void JavascriptMessageBoxHandler::Observe(NotificationType type,
159 const NotificationSource& source, 165 const NotificationSource& source,
160 const NotificationDetails& details) { 166 const NotificationDetails& details) {
161 bool web_contents_gone = false; 167 bool web_contents_gone = false;
162 if (!web_contents_) 168 if (!web_contents_)
163 return; 169 return;
164 170
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Make sure we get navigation notifications so we know when our parent 210 // Make sure we get navigation notifications so we know when our parent
205 // contents will disappear or navigate to a different page. 211 // contents will disappear or navigate to a different page.
206 NotificationService::current()-> 212 NotificationService::current()->
207 AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED, 213 AddObserver(this, NOTIFY_NAV_ENTRY_COMMITTED,
208 NotificationService::AllSources()); 214 NotificationService::AllSources());
209 NotificationService::current()-> 215 NotificationService::current()->
210 AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED, 216 AddObserver(this, NOTIFY_TAB_CONTENTS_DESTROYED,
211 NotificationService::AllSources()); 217 NotificationService::AllSources());
212 } 218 }
213 219
OLDNEW
« no previous file with comments | « chrome/browser/jsmessage_box_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698