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

Side by Side Diff: chrome/browser/extensions/api/identity/web_auth_flow.cc

Issue 16702003: Move ShellWindow into apps component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: yar Created 7 years, 5 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/extensions/api/identity/web_auth_flow.h" 5 #include "chrome/browser/extensions/api/identity/web_auth_flow.h"
6 6
7 #include "apps/shell_window.h"
7 #include "base/base64.h" 8 #include "base/base64.h"
8 #include "base/location.h" 9 #include "base/location.h"
9 #include "base/message_loop.h" 10 #include "base/message_loop.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/extensions/component_loader.h" 13 #include "chrome/browser/extensions/component_loader.h"
13 #include "chrome/browser/extensions/event_router.h" 14 #include "chrome/browser/extensions/event_router.h"
14 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/extension_system.h" 16 #include "chrome/browser/extensions/extension_system.h"
16 #include "chrome/browser/extensions/extension_system.h" 17 #include "chrome/browser/extensions/extension_system.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/extensions/shell_window.h"
19 #include "chrome/common/extensions/extension_constants.h" 19 #include "chrome/common/extensions/extension_constants.h"
20 #include "content/public/browser/navigation_details.h" 20 #include "content/public/browser/navigation_details.h"
21 #include "content/public/browser/navigation_entry.h" 21 #include "content/public/browser/navigation_entry.h"
22 #include "content/public/browser/notification_details.h" 22 #include "content/public/browser/notification_details.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
25 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/render_view_host.h" 26 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/resource_request_details.h" 27 #include "content/public/browser/resource_request_details.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
29 #include "crypto/random.h" 29 #include "crypto/random.h"
30 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
31 #include "grit/browser_resources.h" 31 #include "grit/browser_resources.h"
32 32
33 using apps::ShellWindow;
33 using content::RenderViewHost; 34 using content::RenderViewHost;
34 using content::ResourceRedirectDetails; 35 using content::ResourceRedirectDetails;
35 using content::WebContents; 36 using content::WebContents;
36 using content::WebContentsObserver; 37 using content::WebContentsObserver;
37 38
38 namespace extensions { 39 namespace extensions {
39 40
40 WebAuthFlow::WebAuthFlow( 41 WebAuthFlow::WebAuthFlow(
41 Delegate* delegate, 42 Delegate* delegate,
42 Profile* profile, 43 Profile* profile,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 shell_window_ = shell_window; 118 shell_window_ = shell_window;
118 WebContentsObserver::Observe(shell_window->web_contents()); 119 WebContentsObserver::Observe(shell_window->web_contents());
119 120
120 registrar_.Add( 121 registrar_.Add(
121 this, 122 this,
122 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED, 123 content::NOTIFICATION_WEB_CONTENTS_RENDER_VIEW_HOST_CREATED,
123 content::NotificationService::AllBrowserContextsAndSources()); 124 content::NotificationService::AllBrowserContextsAndSources());
124 } 125 }
125 } 126 }
126 127
128 void WebAuthFlow::OnShellWindowIconChanged(ShellWindow* shell_window) {}
129
127 void WebAuthFlow::OnShellWindowRemoved(ShellWindow* shell_window) { 130 void WebAuthFlow::OnShellWindowRemoved(ShellWindow* shell_window) {
128 if (shell_window->window_key() == shell_window_key_ && 131 if (shell_window->window_key() == shell_window_key_ &&
129 shell_window->extension()->id() == extension_misc::kIdentityApiUiAppId) { 132 shell_window->extension()->id() == extension_misc::kIdentityApiUiAppId) {
130 shell_window_ = NULL; 133 shell_window_ = NULL;
131 registrar_.RemoveAll(); 134 registrar_.RemoveAll();
132 135
133 if (delegate_) 136 if (delegate_)
134 delegate_->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); 137 delegate_->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED);
135 } 138 }
136 } 139 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 239 }
237 240
238 void WebAuthFlow::DidNavigateMainFrame( 241 void WebAuthFlow::DidNavigateMainFrame(
239 const content::LoadCommittedDetails& details, 242 const content::LoadCommittedDetails& details,
240 const content::FrameNavigateParams& params) { 243 const content::FrameNavigateParams& params) {
241 if (delegate_ && details.http_status_code >= 400) 244 if (delegate_ && details.http_status_code >= 400)
242 delegate_->OnAuthFlowFailure(LOAD_FAILED); 245 delegate_->OnAuthFlowFailure(LOAD_FAILED);
243 } 246 }
244 247
245 } // namespace extensions 248 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698