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

Side by Side Diff: plugins/org.chromium.sdk.wipbackend.wk120709/src/org/chromium/sdk/internal/wip/WipFrameManager.java

Issue 11829027: drop old backends (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: Created 7 years, 11 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.sdk.internal.wip;
6
7 import org.chromium.sdk.internal.wip.protocol.input.page.FrameNavigatedEventData ;
8 import org.chromium.sdk.internal.wip.protocol.input.page.FrameValue;
9 import org.chromium.sdk.internal.wip.protocol.input.page.GetResourceTreeData;
10 import org.chromium.sdk.internal.wip.protocol.output.page.GetResourceTreeParams;
11 import org.chromium.sdk.util.GenericCallback;
12
13 /**
14 * Collects information about frame tree. At first class only watches for the ur l of root frame.
15 */
16 class WipFrameManager {
17 private final WipTabImpl tabImpl;
18 private boolean urlUnknown = true;
19
20 WipFrameManager(WipTabImpl tabImpl) {
21 this.tabImpl = tabImpl;
22 }
23
24 void readFrames() {
25 GetResourceTreeParams requestParams = new GetResourceTreeParams();
26 GenericCallback<GetResourceTreeData> callback =
27 new GenericCallback<GetResourceTreeData>() {
28 @Override
29 public void success(GetResourceTreeData value) {
30 FrameValue frame = value.frameTree().frame();
31 if (frame.parentId() != null) {
32 throw new RuntimeException("Unexpected parentId value");
33 }
34 String url = frame.url();
35 boolean silentUpdate = urlUnknown;
36 tabImpl.updateUrl(url, silentUpdate);
37 urlUnknown = false;
38 }
39
40 @Override public void failure(Exception exception) {
41 throw new RuntimeException("Failed to read frame data", exception);
42 }
43 };
44
45 tabImpl.getCommandProcessor().send(requestParams, callback, null);
46 }
47
48 void frameNavigated(FrameNavigatedEventData eventData) {
49 FrameValue frame = eventData.frame();
50 String parentId = frame.parentId();
51 if (parentId == null) {
52 String newUrl = frame.url();
53 tabImpl.updateUrl(newUrl, false);
54 urlUnknown = false;
55 }
56 }
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698